<html>
<head><meta charset="utf-8"><title>rustc binder refactor · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html">rustc binder refactor</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212328935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212328935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212328935">(Oct 05 2020 at 17:09)</a>:</h4>
<p>Well, I'm down a rabbit hole</p>



<a name="212328989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212328989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212328989">(Oct 05 2020 at 17:09)</a>:</h4>
<p>So, I tried to add a <code>'tcx List&lt;BinderVariableKind&gt;</code> field to <code>Binder</code></p>



<a name="212329055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329055">(Oct 05 2020 at 17:10)</a>:</h4>
<p>So, I have to add a new <code>'tcx</code> param</p>



<a name="212329087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329087">(Oct 05 2020 at 17:10)</a>:</h4>
<p>well, that seems to have broken hashing related stuff</p>



<a name="212329127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329127">(Oct 05 2020 at 17:11)</a>:</h4>
<p>I'm not quite sure if all the holes I've plugged have been right</p>



<a name="212329169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329169">(Oct 05 2020 at 17:11)</a>:</h4>
<p>But, it's essentially let me to this function: <a href="https://github.com/rust-lang/rust/blob/f317a93d4d326442680eaeb78c22eece739433c7/compiler/rustc_middle/src/ich/impls_ty.rs#L136">https://github.com/rust-lang/rust/blob/f317a93d4d326442680eaeb78c22eece739433c7/compiler/rustc_middle/src/ich/impls_ty.rs#L136</a></p>



<a name="212329200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329200">(Oct 05 2020 at 17:11)</a>:</h4>
<p>That the <code>'tcx</code> there can't escape the closure</p>



<a name="212329381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329381">(Oct 05 2020 at 17:13)</a>:</h4>
<p>Because I had to add a <code>'tcx: '__ctx</code> (technically all lifetimes on the struct outlive the '__ctx) here: <a href="https://github.com/rust-lang/rust/blob/f317a93d4d326442680eaeb78c22eece739433c7/compiler/rustc_macros/src/hash_stable.rs#L92">https://github.com/rust-lang/rust/blob/f317a93d4d326442680eaeb78c22eece739433c7/compiler/rustc_macros/src/hash_stable.rs#L92</a></p>



<a name="212329392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329392">(Oct 05 2020 at 17:13)</a>:</h4>
<p>Which is probably not the right thing</p>



<a name="212329787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212329787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212329787">(Oct 05 2020 at 17:16)</a>:</h4>
<p>But, if I don't add that, I get errors like:</p>
<div class="codehilite"><pre><span></span><code>1178 |   #[derive(HashStable, TypeFoldable)]
     |            ^^^^^^^^^^
     |            |
     |            lifetime `&#39;__ctx` defined here
     |            argument requires that `&#39;tcx` must outlive `&#39;__ctx`
     |            in this macro invocation
1179 |   pub struct FnSig&lt;&#39;tcx&gt; {
     |                    ---- lifetime `&#39;tcx` defined here
</code></pre></div>



<a name="212478877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212478877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212478877">(Oct 06 2020 at 20:10)</a>:</h4>
<p>one thing</p>



<a name="212478905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212478905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212478905">(Oct 06 2020 at 20:10)</a>:</h4>
<p>in chalk we have the <code>HasInterner</code> trait partly for this reason</p>



<a name="212478926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212478926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212478926">(Oct 06 2020 at 20:10)</a>:</h4>
<p>I think it's important that it is <code>Binder&lt;Ty&lt;'tcx&gt;&gt;</code> and not <code>Binder&lt;'tcx, Ty&lt;'tcx&gt;&gt;</code></p>



<a name="212478931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212478931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212478931">(Oct 06 2020 at 20:10)</a>:</h4>
<p>or whatever</p>



<a name="212478965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212478965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212478965">(Oct 06 2020 at 20:10)</a>:</h4>
<p>I'm not sure if that in any way adresses your <em>actual</em> problem</p>



<a name="212479237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212479237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212479237">(Oct 06 2020 at 20:13)</a>:</h4>
<p>Well, I fixed the actual problem</p>



<a name="212479254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212479254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212479254">(Oct 06 2020 at 20:13)</a>:</h4>
<p>But I had to make it <code>Binder&lt;'tcx, Ty&lt;'tcx&gt;&gt;</code></p>



<a name="212479290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212479290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212479290">(Oct 06 2020 at 20:13)</a>:</h4>
<p>Since I'm storing a <code>&amp;'tcx List&lt;...&gt;</code></p>



<a name="212479415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/212479415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#212479415">(Oct 06 2020 at 20:14)</a>:</h4>
<p>But yeah, <code>HasInterner</code> would be good</p>



<a name="213087672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213087672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213087672">(Oct 12 2020 at 21:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> any thoughts on: <a href="https://github.com/rust-lang/rust/issues/77685">#77685</a></p>



<a name="213087679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213087679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213087679">(Oct 12 2020 at 21:20)</a>:</h4>
<p>(don't mind the error, I have to fix that)</p>



<a name="213087745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213087745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213087745">(Oct 12 2020 at 21:21)</a>:</h4>
<p>particularly: <a href="https://github.com/rust-lang/rust/pull/77685#issuecomment-705675057">https://github.com/rust-lang/rust/pull/77685#issuecomment-705675057</a></p>



<a name="213087855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213087855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213087855">(Oct 12 2020 at 21:22)</a>:</h4>
<p>looking now</p>



<a name="213089222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213089222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213089222">(Oct 12 2020 at 21:41)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> left my thoughts</p>



<a name="213089533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213089533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213089533">(Oct 12 2020 at 21:45)</a>:</h4>
<p>I saw, left a response to your review</p>



<a name="213404990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213404990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213404990">(Oct 15 2020 at 10:24)</a>:</h4>
<p>I'd be curious <span class="user-mention" data-user-id="216206">@lcnr</span> <a href="https://github.com/rust-lang/rust/pull/77685#issuecomment-707360274">what you think about this</a>. I can imagine an argument of "sounds nice in theory but doesn't really seem to make code that much easier to read in practice"</p>



<a name="213429849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213429849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213429849">(Oct 15 2020 at 14:03)</a>:</h4>
<p>it does seem nice in theory <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="213430097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213430097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213430097">(Oct 15 2020 at 14:04)</a>:</h4>
<p>I think using something like <code>y.with_binders_of(&amp;x)</code> is useful and we can even <code>debug_assert</code> that this is correct afaict</p>



<a name="213430472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213430472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213430472">(Oct 15 2020 at 14:07)</a>:</h4>
<p>So I think that if we use a new method for this which does check that we actually keep the same bound vars I think that this change is good even if we never want to store the number of bound vars in the binder itself</p>



<a name="213453378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213453378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213453378">(Oct 15 2020 at 16:43)</a>:</h4>
<p>So, the things is, we don't know what the bound vars actually are. And, short of walking the type and collecting them, we can't. Assuming that things work out perf wise and such, we <em>will</em>. So there's nothing to debug assert.</p>



<a name="213453568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213453568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213453568">(Oct 15 2020 at 16:45)</a>:</h4>
<p>My only concern with <code>y.with_binders(&amp;x)</code> is that we would probably do that with a trait, and then we have to <code>use</code> the trait everywhere</p>



<a name="213466887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213466887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213466887">(Oct 15 2020 at 18:20)</a>:</h4>
<p>so otherwise <code>ty::Binder::bind_with_binders(&amp;value).of(&amp;original_value)</code></p>



<a name="213466931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213466931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213466931">(Oct 15 2020 at 18:20)</a>:</h4>
<p>or <code>original_values.use_binder_for(result)</code></p>



<a name="213467008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213467008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213467008">(Oct 15 2020 at 18:21)</a>:</h4>
<blockquote>
<p>short of walking the type and collecting them</p>
</blockquote>
<p>yeah, that's what I would do as a debug assertion, not sure what the perf impact for this would be though</p>



<a name="213467076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213467076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213467076">(Oct 15 2020 at 18:21)</a>:</h4>
<p>I do think it would be nice if we were able to just do that</p>



<a name="213467185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213467185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213467185">(Oct 15 2020 at 18:22)</a>:</h4>
<p>we may even add the amount of unbound vars to <code>TyS</code> or something like this to speed this up</p>



<a name="213468130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213468130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213468130">(Oct 15 2020 at 18:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213466887">said</a>:</p>
<blockquote>
<p>so otherwise <code>ty::Binder::bind_with_binders(&amp;value).of(&amp;original_value)</code></p>
</blockquote>
<p>That is imo much worse the <code>original_value.map_bound(|| value)</code></p>



<a name="213468203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213468203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213468203">(Oct 15 2020 at 18:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213466931">said</a>:</p>
<blockquote>
<p>or <code>original_values.use_binder_for(result)</code></p>
</blockquote>
<p>Which this is, other than name</p>



<a name="213468288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213468288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213468288">(Oct 15 2020 at 18:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213467008">said</a>:</p>
<blockquote>
<blockquote>
<p>short of walking the type and collecting them</p>
</blockquote>
<p>yeah, that's what I would do as a debug assertion, not sure what the perf impact for this would be though</p>
</blockquote>
<p>This is more or less what I originally did in my other PR. Perf was <em>really</em> bad.</p>



<a name="213468455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213468455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213468455">(Oct 15 2020 at 18:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213467185">said</a>:</p>
<blockquote>
<p>we may even add the amount of unbound vars to <code>TyS</code> or something like this to speed this up</p>
</blockquote>
<p>I mean, you theoretically could optimize this based on the <code>has_escaping_vars</code> flag</p>



<a name="213469638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469638">(Oct 15 2020 at 18:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213468203">said</a>:</p>
<blockquote>
<p>Which this is, other than name</p>
</blockquote>
<p>I think that the point is that using a distinct name is a good idea</p>



<a name="213469650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469650">(Oct 15 2020 at 18:41)</a>:</h4>
<p>(which I agree with)</p>



<a name="213469758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469758">(Oct 15 2020 at 18:42)</a>:</h4>
<p>I'm not sure I like the name <code>use_binder_for</code>, but some distinct name makes sense; it's kind of nonobvious what's going on with <code>map_bound_ref</code>, kind of like when people use <code>foo.all(c =&gt; ...)</code> in JS to do a for loop.</p>



<a name="213469801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469801">(Oct 15 2020 at 18:42)</a>:</h4>
<p>I'm trying to brainstorm some names now</p>



<a name="213469822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469822">(Oct 15 2020 at 18:42)</a>:</h4>
<p><code>copy_binders</code></p>



<a name="213469843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213469843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213469843">(Oct 15 2020 at 18:43)</a>:</h4>
<p>I guess <code>use_binders_for</code> or something is not terrible</p>



<a name="213470279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213470279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213470279">(Oct 15 2020 at 18:46)</a>:</h4>
<p>I mean, I kind of prefer just <code>map_bound</code></p>



<a name="213470379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213470379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213470379">(Oct 15 2020 at 18:47)</a>:</h4>
<p>But I could also imagine that we could do: <code>original_value.binders().bind(value)</code></p>



<a name="213470407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213470407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213470407">(Oct 15 2020 at 18:47)</a>:</h4>
<p>Where <code>binders()</code> returns a ZST</p>



<a name="213470561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213470561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213470561">(Oct 15 2020 at 18:48)</a>:</h4>
<p>You could also imagine this could extend to like chalk, where <code>binders()</code> would return <code>VariableKinds</code> and then there can also be a <code>bind</code> function</p>



<a name="213470851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213470851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213470851">(Oct 15 2020 at 18:51)</a>:</h4>
<p>In chalk, it would look like:</p>
<div class="codehilite"><pre><span></span><code>impl&lt;I: Interner&gt; VariableKinds&lt;I&gt; {
  fn bind&lt;T&gt;(self, value: T) -&gt; Binders&lt;T&gt;  {
    Binders::new(self, value)
  }
}
</code></pre></div>



<a name="213472098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472098">(Oct 15 2020 at 18:58)</a>:</h4>
<p><code>old.binders().bind(value)</code> does look quite nice to me</p>



<a name="213472141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472141">(Oct 15 2020 at 18:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213468288">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213467008">said</a>:</p>
<blockquote>
<blockquote>
<p>short of walking the type and collecting them</p>
</blockquote>
<p>yeah, that's what I would do as a debug assertion, not sure what the perf impact for this would be though</p>
</blockquote>
<p>This is more or less what I originally did in my other PR. Perf was <em>really</em> bad.</p>
</blockquote>
<p>what level of <em>really</em> bad are we talking about here?</p>



<a name="213472313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472313">(Oct 15 2020 at 19:00)</a>:</h4>
<p>i am not too sure about debug builds, but I personally feel that about a 10 % perf hit is ok if this is something we care about. Otherwise it might make sense to put this behind a feature flag or something</p>



<a name="213472607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472607">(Oct 15 2020 at 19:02)</a>:</h4>
<p><a href="/user_uploads/4715/_Y4WMUwRQz-CFXPuthBsoePE/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/_Y4WMUwRQz-CFXPuthBsoePE/image.png" title="image.png"><img src="/user_uploads/4715/_Y4WMUwRQz-CFXPuthBsoePE/image.png"></a></div>



<a name="213472628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472628">(Oct 15 2020 at 19:02)</a>:</h4>
<p>(<a href="https://perf.rust-lang.org/compare.html?start=285fc7d704fcdd7b2a37d475d04d5d955490e000&amp;end=e3ccacbe714c3e189a4895651ada1f854960ddf8">https://perf.rust-lang.org/compare.html?start=285fc7d704fcdd7b2a37d475d04d5d955490e000&amp;end=e3ccacbe714c3e189a4895651ada1f854960ddf8</a>)</p>



<a name="213472694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472694">(Oct 15 2020 at 19:02)</a>:</h4>
<p>ok</p>



<a name="213472701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472701">(Oct 15 2020 at 19:02)</a>:</h4>
<p>ok</p>



<a name="213472722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472722">(Oct 15 2020 at 19:03)</a>:</h4>
<p>For the other tests, it wasn't <em>that</em> bad</p>



<a name="213472735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472735">(Oct 15 2020 at 19:03)</a>:</h4>
<p>Most were 10% or less</p>



<a name="213472767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472767">(Oct 15 2020 at 19:03)</a>:</h4>
<p>But this was also just about the most naive way to do this</p>



<a name="213472779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472779">(Oct 15 2020 at 19:03)</a>:</h4>
<p>yeah, we should be able to only do a shallow inspection here</p>



<a name="213472831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472831">(Oct 15 2020 at 19:03)</a>:</h4>
<p>so that we can stop at <code>Ty</code> and <code>Predicate</code></p>



<a name="213472852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472852">(Oct 15 2020 at 19:03)</a>:</h4>
<p>which should be the only deeply nested things we use</p>



<a name="213472926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472926">(Oct 15 2020 at 19:04)</a>:</h4>
<p>and already cache some stuff</p>



<a name="213472941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472941">(Oct 15 2020 at 19:04)</a>:</h4>
<p>Well, if a <code>Ty</code> does have escaping bound vars, we have to descend</p>



<a name="213472960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472960">(Oct 15 2020 at 19:04)</a>:</h4>
<p>but not all <em>parts</em> of the <code>Ty</code> might</p>



<a name="213472988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213472988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213472988">(Oct 15 2020 at 19:04)</a>:</h4>
<p>The only other bit that makes debug asserting difficult</p>



<a name="213473048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473048">(Oct 15 2020 at 19:05)</a>:</h4>
<p>is that there <em>are</em> times were a type may have <code>^0</code> and <code>^2</code></p>



<a name="213473058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473058">(Oct 15 2020 at 19:05)</a>:</h4>
<p>And skip one</p>



<a name="213473193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473193">(Oct 15 2020 at 19:06)</a>:</h4>
<p>And, by that logic, it's also completely that a <code>Ty</code> may not name the <em>last</em> bound var</p>



<a name="213473202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473202">(Oct 15 2020 at 19:06)</a>:</h4>
<p>But then on rebind it could</p>



<a name="213473223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473223">(Oct 15 2020 at 19:06)</a>:</h4>
<p>In practice, I don't know how often that actually happens</p>



<a name="213473256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473256">(Oct 15 2020 at 19:06)</a>:</h4>
<p>(last time I worked on that branch, that's about where I had to stop)</p>



<a name="213473311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473311">(Oct 15 2020 at 19:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213472098">said</a>:</p>
<blockquote>
<p><code>old.binders().bind(value)</code> does look quite nice to me</p>
</blockquote>
<p>For now, I also kind of like this. If everyone is on board, I can update the PR to use this</p>



<a name="213473330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213473330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213473330">(Oct 15 2020 at 19:07)</a>:</h4>
<p>And we can postpone the debug assert to another PR</p>



<a name="213475966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213475966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213475966">(Oct 15 2020 at 19:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213473048">said</a>:</p>
<blockquote>
<p>is that there <em>are</em> times were a type may have <code>^0</code> and <code>^2</code></p>
</blockquote>
<p>just looked a bit at the current approach in chalk and <a href="#narrow/stream/144729-wg-traits/topic/extending.20.60Binder.60.20in.20rustc.20to.20include.20.23.20of.20bound.20variables">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/extending.20.60Binder.60.20in.20rustc.20to.20include.20.23.20of.20bound.20variables</a> and think that I now actually understand both the goal and this concern.</p>



<a name="213476057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213476057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213476057">(Oct 15 2020 at 19:29)</a>:</h4>
<p>so yeah, I think that going ahead with <code>old.binders().bind(value)</code> is good. <span class="user-mention" data-user-id="116009">@nikomatsakis</span> are you also on board here?</p>



<a name="213489754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489754">(Oct 15 2020 at 21:24)</a>:</h4>
<p>yeah I like that well enough</p>



<a name="213489773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489773">(Oct 15 2020 at 21:24)</a>:</h4>
<p>"cute"</p>



<a name="213489825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489825">(Oct 15 2020 at 21:24)</a>:</h4>
<p>I'm not sure I'd bother with the <code>binders().bind</code> but it seems "ok"</p>



<a name="213489833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489833">(Oct 15 2020 at 21:24)</a>:</h4>
<p>vs <code>.rebind()</code> or something?</p>



<a name="213489877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489877">(Oct 15 2020 at 21:25)</a>:</h4>
<p>or even just <code>foo.bind(bar)</code></p>



<a name="213489900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489900">(Oct 15 2020 at 21:25)</a>:</h4>
<p>I guess <span class="user-mention" data-user-id="232957">@Jack Huey</span> <code>binders</code> could return a <code>Binder&lt;()&gt;</code></p>



<a name="213489931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213489931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213489931">(Oct 15 2020 at 21:25)</a>:</h4>
<p>I like <code>.binders().bind()</code> better than <code>map_bound_ref</code>, which I think is not very clear</p>



<a name="213490047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213490047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213490047">(Oct 15 2020 at 21:26)</a>:</h4>
<p>I mean, if <code>binders</code> returned <code>Binder&lt;()&gt;</code>, then we're still back to "what name should we pick"</p>



<a name="213490054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213490054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213490054">(Oct 15 2020 at 21:26)</a>:</h4>
<p>i.e. what <code>map_bound_ref</code> is</p>



<a name="213490190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213490190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213490190">(Oct 15 2020 at 21:28)</a>:</h4>
<p>(using type ascription here for clarity): <code>(old: Binder&lt;T&gt;).rebind(value)</code> could work</p>



<a name="213490373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213490373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213490373">(Oct 15 2020 at 21:30)</a>:</h4>
<p>So far, I prefer <code>old.binders().bind(value)</code> or just <code>old.rebind(value)</code></p>



<a name="213490409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213490409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213490409">(Oct 15 2020 at 21:30)</a>:</h4>
<p>Or, if we like having <code>binders()</code> return <code>Binder&lt;()&gt;</code>, then <code>old.binders().rebind(value)</code> is also valid</p>



<a name="213491995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213491995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213491995">(Oct 15 2020 at 21:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213490047">said</a>:</p>
<blockquote>
<p>I mean, if <code>binders</code> returned <code>Binder&lt;()&gt;</code>, then we're still back to "what name should we pick"</p>
</blockquote>
<p>I just imagined <code>bind</code> might be offered only on <code>Binders&lt;()&gt;</code>, but it's kind of silly</p>



<a name="213492011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213492011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213492011">(Oct 15 2020 at 21:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/213490373">said</a>:</p>
<blockquote>
<p>So far, I prefer <code>old.binders().bind(value)</code> or just <code>old.rebind(value)</code></p>
</blockquote>
<p>agreed</p>



<a name="213492030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213492030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213492030">(Oct 15 2020 at 21:45)</a>:</h4>
<p>I feel like the former is cute but might feel clunky after a while</p>



<a name="213492897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213492897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213492897">(Oct 15 2020 at 21:53)</a>:</h4>
<p>Okay so <code>old.rebind(value)</code> it is</p>



<a name="213535714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213535714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213535714">(Oct 16 2020 at 09:08)</a>:</h4>
<p>yeah, looks fine to me <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="213595307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213595307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213595307">(Oct 16 2020 at 18:11)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span>  PR is ready (<a href="https://github.com/rust-lang/rust/issues/77685">#77685</a>)</p>



<a name="213600263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213600263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213600263">(Oct 16 2020 at 18:54)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> gj</p>



<a name="213602674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213602674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213602674">(Oct 16 2020 at 19:17)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> updated for your review</p>



<a name="213715671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715671">(Oct 18 2020 at 17:11)</a>:</h4>
<p>So, whelp rebasing this on master has <em>worse</em> perf results from before</p>



<a name="213715692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715692">(Oct 18 2020 at 17:11)</a>:</h4>
<p>Importantly, there was a change between the last perf run and now regarding cyclic tys, so I don't know if that's the problem</p>



<a name="213715745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715745">(Oct 18 2020 at 17:12)</a>:</h4>
<p>(I ran into that issue while rebasing at some point, but thought I had covered that)</p>



<a name="213715756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715756">(Oct 18 2020 at 17:12)</a>:</h4>
<p>there are cyclic types?</p>



<a name="213715774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715774">(Oct 18 2020 at 17:13)</a>:</h4>
<p>But also, there has been the projection bounds PR that got merged</p>



<a name="213715778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715778">(Oct 18 2020 at 17:13)</a>:</h4>
<p>Well, cyclic type errors</p>



<a name="213715780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715780">(Oct 18 2020 at 17:13)</a>:</h4>
<p>let me find that PR</p>



<a name="213715842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715842">(Oct 18 2020 at 17:14)</a>:</h4>
<p>Sorry, type length: <a href="https://github.com/rust-lang/rust/issues/76843">#76843</a></p>



<a name="213715883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715883">(Oct 18 2020 at 17:16)</a>:</h4>
<p>From this, I had to add <code>Miniset</code> to the <code>CountBoundVars</code> struct</p>



<a name="213715918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715918">(Oct 18 2020 at 17:16)</a>:</h4>
<p>Wait....did I backport that change to this commit...</p>



<a name="213715952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715952">(Oct 18 2020 at 17:17)</a>:</h4>
<p>are you sure that <a href="https://github.com/rust-lang/rust/issues/76843">#76843</a> is the right PR? can't see how that one's related rn</p>



<a name="213715963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715963">(Oct 18 2020 at 17:17)</a>:</h4>
<p>maybe that's not it</p>



<a name="213715967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213715967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213715967">(Oct 18 2020 at 17:17)</a>:</h4>
<p>it was related, though</p>



<a name="213716068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213716068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213716068">(Oct 18 2020 at 17:19)</a>:</h4>
<p>It was: <a href="https://github.com/rust-lang/rust/issues/72412">#72412</a></p>



<a name="213716139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213716139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213716139">(Oct 18 2020 at 17:21)</a>:</h4>
<p>And I <em>didn't</em> backport my <code>Miniset</code> fix, so I guess that makes sense why it was taking so long</p>



<a name="213716513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/213716513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#213716513">(Oct 18 2020 at 17:30)</a>:</h4>
<p>annnnd....I can't find the changes I had made</p>



<a name="214766158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/214766158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#214766158">(Oct 27 2020 at 21:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/meeting.202020-10-27/near/214765275">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/meeting.202020-10-27/near/214763401">said</a>:</p>
<blockquote>
<h1>Refactor rustc’s Binder to track bound vars</h1>
</blockquote>
<p>that's something I am quite interested in, so if you ever need another opinion or pair of eyes here please notify me</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-tcx-rebase2">https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-tcx-rebase2</a> is current status</p>



<a name="214766170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/214766170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#214766170">(Oct 27 2020 at 21:24)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> ^</p>



<a name="214766202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/214766202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#214766202">(Oct 27 2020 at 21:25)</a>:</h4>
<p>Forgive the terrible branch name, obviously gone through a rebase or two</p>



<a name="214766329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/214766329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#214766329">(Oct 27 2020 at 21:26)</a>:</h4>
<p>I'm currently just going through the remaining <code>Binder::bind</code>s and either: a) changing it to <code>Binder::dummy</code> when it probably should be or b) Explicitly giving a <code>List&lt;BoundVariableKind&gt;</code></p>



<a name="214766368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/214766368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#214766368">(Oct 27 2020 at 21:26)</a>:</h4>
<p>Or I guess c) making sure we're probably passing around a <code>Binder</code> wrapper</p>



<a name="215673244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/215673244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#215673244">(Nov 05 2020 at 05:42)</a>:</h4>
<p>So turns out <a href="https://github.com/rust-lang/rust/blob/0fb00251a578018430bad6687ff74e14031d2a07/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1691">this</a> comment is perhaps no so correct when you think about out <code>Binder</code> being more than just a newtype wrapper</p>



<a name="216644163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644163">(Nov 13 2020 at 17:27)</a>:</h4>
<p>So, current status here:</p>



<a name="216644312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644312">(Nov 13 2020 at 17:28)</a>:</h4>
<p>Basically, been trying to make <em>all</em> late bound regions in a types be anon, with the <code>ReNamed</code>/<code>ReAnon</code>/<code>ReEnv</code> info being stored in the binders</p>



<a name="216644340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644340">(Nov 13 2020 at 17:28)</a>:</h4>
<p><code>ReEnv</code> was actually really easy</p>



<a name="216644392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644392">(Nov 13 2020 at 17:28)</a>:</h4>
<p><code>ReAnon</code>/<code>ReNamed</code> are harder.</p>



<a name="216644419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644419">(Nov 13 2020 at 17:29)</a>:</h4>
<p>Since these are generated by <code>AstConv</code></p>



<a name="216644478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644478">(Nov 13 2020 at 17:29)</a>:</h4>
<p>by essentially calling <code>AstConv::ast_ty_to_ty</code> and then <code>Binder::bind</code> over that</p>



<a name="216644588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644588">(Nov 13 2020 at 17:30)</a>:</h4>
<p>The problem, is that currently it seems like there isn't sort of a single unified place that the list of binders are created</p>



<a name="216644640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644640">(Nov 13 2020 at 17:30)</a>:</h4>
<p>But I'm <em>really</em> not familiar with this code.</p>



<a name="216644660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216644660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216644660">(Nov 13 2020 at 17:31)</a>:</h4>
<p>So, could use some guidance. <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="216726745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216726745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216726745">(Nov 14 2020 at 12:36)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> yeah :)</p>



<a name="216726748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216726748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216726748">(Nov 14 2020 at 12:36)</a>:</h4>
<p>hmm</p>



<a name="216726765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216726765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216726765">(Nov 14 2020 at 12:36)</a>:</h4>
<p>this code is kind of a mess</p>



<a name="216726786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216726786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216726786">(Nov 14 2020 at 12:37)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> how about we schedule an hour on monday to talk over it?</p>



<a name="216726805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216726805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216726805">(Nov 14 2020 at 12:37)</a>:</h4>
<p>we probably want to start in <code>resolve_lifetimes</code></p>



<a name="216740895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216740895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216740895">(Nov 14 2020 at 17:44)</a>:</h4>
<p>I'm good to schedule some time on Monday. Anytime is good for me.</p>



<a name="216788387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216788387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216788387">(Nov 15 2020 at 11:57)</a>:</h4>
<p>how about <time datetime="2020-11-16T18:00:00Z">2020-11-16T13:00:00-05:00</time> ?</p>



<a name="216788388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216788388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216788388">(Nov 15 2020 at 11:57)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="216788455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216788455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216788455">(Nov 15 2020 at 11:59)</a>:</h4>
<p>sent an invite, put on the compiler team calendar</p>



<a name="216788458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216788458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216788458">(Nov 15 2020 at 11:59)</a>:</h4>
<p>I attached a zoom room though maybe this would be nice over zulip for accessibility of others</p>



<a name="216799411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216799411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216799411">(Nov 15 2020 at 15:55)</a>:</h4>
<p>Works for me</p>



<a name="216907830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216907830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216907830">(Nov 16 2020 at 17:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> still good for meeting?</p>



<a name="216908560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216908560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216908560">(Nov 16 2020 at 18:04)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> yep but i'm making some coffee, gimme 5 minutes</p>



<a name="216908607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216908607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216908607">(Nov 16 2020 at 18:04)</a>:</h4>
<p>no problem, still want to do zoom?</p>



<a name="216909403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909403">(Nov 16 2020 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> ok I'm here</p>



<a name="216909409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909409">(Nov 16 2020 at 18:10)</a>:</h4>
<p>zoom or zulip is fine</p>



<a name="216909421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909421">(Nov 16 2020 at 18:10)</a>:</h4>
<p>maybe zoom</p>



<a name="216909429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909429">(Nov 16 2020 at 18:10)</a>:</h4>
<p>Let's do zoom</p>



<a name="216909517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909517">(Nov 16 2020 at 18:11)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-tcx-rebase2">https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-tcx-rebase2</a></p>



<a name="216909535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/216909535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#216909535">(Nov 16 2020 at 18:11)</a>:</h4>
<p><a href="https://github.com/jackh726/rust/commit/8ad856451402255b25cb83586890cda528c650b7">https://github.com/jackh726/rust/commit/8ad856451402255b25cb83586890cda528c650b7</a></p>



<a name="217457281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457281">(Nov 20 2020 at 20:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> around?</p>



<a name="217457311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457311">(Nov 20 2020 at 20:53)</a>:</h4>
<p>So, <code>resolve_lifetimes</code> visit closures, right?</p>



<a name="217457678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457678">(Nov 20 2020 at 20:57)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> I'm sort of around</p>



<a name="217457679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457679">(Nov 20 2020 at 20:57)</a>:</h4>
<p>it does visit closures</p>



<a name="217457731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457731">(Nov 20 2020 at 20:58)</a>:</h4>
<p>I guess, let me back up and say: turns out we can't just walk the e.g. <code>FnSig</code> later to get late bound vars</p>



<a name="217457783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457783">(Nov 20 2020 at 20:58)</a>:</h4>
<p>since you can have something like <code>fn foo&lt;'a&gt;()</code> where <code>'a</code> is unused</p>



<a name="217457811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457811">(Nov 20 2020 at 20:58)</a>:</h4>
<p>So, been basically making <code>resolve_lifetimes</code> try to store the bound vars</p>



<a name="217457818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457818">(Nov 20 2020 at 20:58)</a>:</h4>
<p>I'm like 70% there</p>



<a name="217457855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457855">(Nov 20 2020 at 20:59)</a>:</h4>
<p>But, at a point where running into issues compiling this: <a href="https://github.com/rust-lang/rust/blob/593fe977a77ad5a7aec23c6cb0f86a3470221670/library/core/src/iter/adapters/mod.rs#L246">https://github.com/rust-lang/rust/blob/593fe977a77ad5a7aec23c6cb0f86a3470221670/library/core/src/iter/adapters/mod.rs#L246</a></p>



<a name="217457884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457884">(Nov 20 2020 at 20:59)</a>:</h4>
<p>Because it asks "what are the binders for that inner closure"</p>



<a name="217457905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217457905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217457905">(Nov 20 2020 at 21:00)</a>:</h4>
<p>and that didn't get stored</p>



<a name="217458028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217458028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217458028">(Nov 20 2020 at 21:00)</a>:</h4>
<p>I <code>RUSTC_LOG</code>ed it and it enters the <code>Body</code> and then exits it</p>



<a name="217458038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217458038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217458038">(Nov 20 2020 at 21:01)</a>:</h4>
<p>without any other scopes, so investigating</p>



<a name="217458210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217458210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217458210">(Nov 20 2020 at 21:02)</a>:</h4>
<p>but yeah, looking through the code, it looks like it <em>should</em> be visiting that</p>



<a name="217515903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217515903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217515903">(Nov 21 2020 at 19:49)</a>:</h4>
<p>Oh hey <span class="user-mention" data-user-id="116009">@nikomatsakis</span> you're on :)</p>



<a name="217515904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217515904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217515904">(Nov 21 2020 at 19:49)</a>:</h4>
<p>Figured this out</p>



<a name="217515949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217515949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217515949">(Nov 21 2020 at 19:50)</a>:</h4>
<p>So, yeah, closures are visited, but <em>aren't</em> wrapped in a <code>Binder</code> scope</p>



<a name="217717979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217717979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217717979">(Nov 24 2020 at 06:16)</a>:</h4>
<p>Bleh. So, I thought I could jump to just making <code>ReLateBound</code> store a <code>u32</code> instead of <code>BoundRegion</code>, but let's just say I was wrong</p>



<a name="217717980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217717980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217717980">(Nov 24 2020 at 06:16)</a>:</h4>
<p>Basically two different problems:</p>



<a name="217718007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718007">(Nov 24 2020 at 06:17)</a>:</h4>
<p>1) There are non-trivial amount of cases where rustc tries to print a <code>Ty</code> and there's a late-bound region in there</p>



<a name="217718065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718065">(Nov 24 2020 at 06:19)</a>:</h4>
<p>I <em>expect</em> that eventually this can be solved by either creating like a <code>PrettyTy</code> or something. Or by just being a little more careful with making sure that if a type may have late bound vars, we also make sure we're clear <em>where</em> that comes from</p>



<a name="217718075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718075">(Nov 24 2020 at 06:19)</a>:</h4>
<p>(in pretty-printing code)</p>



<a name="217718083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718083">(Nov 24 2020 at 06:19)</a>:</h4>
<p>If this alone was a problem, I could deal, but it's not because....</p>



<a name="217718182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718182">(Nov 24 2020 at 06:21)</a>:</h4>
<p>2) I ended up making <code>BoundRegion</code> be similar to <code>BoundTy</code> where there is a <code>var: BoundVar</code> and <code>kind: BoundRegionKind</code> (which has <code>BrAnon</code>/<code>BrNamed</code>/<code>BrEnv</code>), and well, this combined with some extra debug assertions have shown that there are <em>many</em> places where <code>Binder::bind</code>s are hiding "sharing" of bound var indices</p>



<a name="217718245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718245">(Nov 24 2020 at 06:22)</a>:</h4>
<p>Take this test, for example: <a href="https://github.com/rust-lang/rust/blob/4167d731dcaed3a37217f8850b27d30cbde5f15b/src/test/ui/issues/issue-57156.rs">https://github.com/rust-lang/rust/blob/4167d731dcaed3a37217f8850b27d30cbde5f15b/src/test/ui/issues/issue-57156.rs</a></p>



<a name="217718259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718259">(Nov 24 2020 at 06:23)</a>:</h4>
<p>A super minimal gist of that:</p>



<a name="217718261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718261">(Nov 24 2020 at 06:23)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait Foo&lt;Args&gt; { type Output; }
trait Bar&lt;&#39;a&gt;: for&lt;&#39;s&gt; Foo&lt;&amp;&#39;s ()&gt; {}
fn cb&lt;&#39;a&gt;() -&gt; Box&lt;dyn Bar&lt;&#39;a, Output=bool&gt;&gt;;
</code></pre></div>



<a name="217718432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718432">(Nov 24 2020 at 06:26)</a>:</h4>
<p>Now,  a few things to point out here:</p>



<a name="217718464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718464">(Nov 24 2020 at 06:27)</a>:</h4>
<p>Actually, let me change this a bit to make it easier to explain</p>



<a name="217718474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718474">(Nov 24 2020 at 06:27)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait Foo&lt;Args&gt; { type Output; }
trait Bar: for&lt;&#39;s&gt; Foo&lt;&amp;&#39;s ()&gt; {}
fn cb&lt;T: for&lt;&#39;a&gt; Bar&lt;Output=&amp;&#39;a ()&gt;&gt;();
</code></pre></div>



<a name="217718524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718524">(Nov 24 2020 at 06:28)</a>:</h4>
<p>Now, let's look at that <code>Output=&amp;'a ()</code> part, and imagine what kind of predicate that gets turned into:</p>



<a name="217718553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718553">(Nov 24 2020 at 06:29)</a>:</h4>
<p>Without going through every detail it essentially turns into</p>



<a name="217718636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718636">(Nov 24 2020 at 06:31)</a>:</h4>
<p><code>for&lt;...&gt; &lt;T as Foo&lt;&amp;'s ()&gt;&gt;::Output = &amp;'a ()</code></p>



<a name="217718670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718670">(Nov 24 2020 at 06:32)</a>:</h4>
<p>Well, now we have a problem</p>



<a name="217718697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718697">(Nov 24 2020 at 06:32)</a>:</h4>
<p>Because this has <em>both</em> <code>'s</code> <em>and</em> <code>'a</code></p>



<a name="217718752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718752">(Nov 24 2020 at 06:33)</a>:</h4>
<p>But, if you get <code>'a</code> as <code>^0</code> from the <code>for&lt;'a&gt;</code> in line 3 and <code>'s</code> as <code>^0</code> from the <code>for&lt;'s&gt;</code> in line 2, then we can't just reuse either binders, because they would clash in our predicate</p>



<a name="217718872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718872">(Nov 24 2020 at 06:36)</a>:</h4>
<p>Unfortunately, since currently rustc doesn't care what "index" <code>'a</code> and <code>'s</code> are, it doesn't really matter, and there's no code in place to "shift" vars</p>



<a name="217718876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718876">(Nov 24 2020 at 06:36)</a>:</h4>
<p>Well, now we have to</p>



<a name="217718909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217718909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217718909">(Nov 24 2020 at 06:37)</a>:</h4>
<p>This is really only one example where this sort of thing comes up</p>



<a name="217923746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217923746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217923746">(Nov 25 2020 at 18:45)</a>:</h4>
<p>Hmm, so there is a particular function called <code>subst_supertrait</code>, <span class="user-mention" data-user-id="232957">@Jack Huey</span></p>



<a name="217923753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217923753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217923753">(Nov 25 2020 at 18:45)</a>:</h4>
<p>that I think is managing this particular combination</p>



<a name="217926022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217926022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217926022">(Nov 25 2020 at 19:06)</a>:</h4>
<p>It doesn't manage this case correctly, no</p>



<a name="217926140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217926140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217926140">(Nov 25 2020 at 19:07)</a>:</h4>
<p>Well, it does sort of think about "nested" <code>for&lt;...&gt;</code>s, but it doesn't shift variables or anything when they overlap</p>



<a name="217926213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217926213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217926213">(Nov 25 2020 at 19:08)</a>:</h4>
<p>Also, when I do shift variables, I'm getting region errors. So still more work to do</p>



<a name="217929031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217929031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217929031">(Nov 25 2020 at 19:32)</a>:</h4>
<p>yeah I just meant that it's the point where we <em>combine</em> those two binders</p>



<a name="217930709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217930709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217930709">(Nov 25 2020 at 19:47)</a>:</h4>
<p>It is one point</p>



<a name="217930716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217930716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217930716">(Nov 25 2020 at 19:47)</a>:</h4>
<p>but it's done elsewhere</p>



<a name="217963258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217963258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217963258">(Nov 26 2020 at 03:50)</a>:</h4>
<p>Well, I'm really stuck with this.</p>



<a name="217963261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/217963261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#217963261">(Nov 26 2020 at 03:50)</a>:</h4>
<p>This is a really fundamental issue.</p>



<a name="219392217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219392217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219392217">(Dec 09 2020 at 20:21)</a>:</h4>
<p>Alright, so I've <a href="https://github.com/rust-lang/rust/compare/master...jackh726:cont">this branch</a> to where all the ui tests pass</p>



<a name="219392289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219392289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219392289">(Dec 09 2020 at 20:21)</a>:</h4>
<p>But, along the way, I changed behavior slightly in regards to incremental</p>



<a name="219392362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219392362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219392362">(Dec 09 2020 at 20:22)</a>:</h4>
<p>Basically around extra unused generics</p>



<a name="219392478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219392478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219392478">(Dec 09 2020 at 20:23)</a>:</h4>
<p>So, incremental tests fail here: <a href="https://github.com/rust-lang/rust/blob/c16d52db7778fba1c8b6c07b06510cfd6c32ae4f/src/test/incremental/hashes/inherent_impls.rs#L317">https://github.com/rust-lang/rust/blob/c16d52db7778fba1c8b6c07b06510cfd6c32ae4f/src/test/incremental/hashes/inherent_impls.rs#L317</a></p>



<a name="219392619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219392619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219392619">(Dec 09 2020 at 20:24)</a>:</h4>
<p>The reasoning behind this is a bit subtle, but essentially it's because somewhere along the line, one has empty binders vs ['a]</p>



<a name="219453466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219453466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219453466">(Dec 10 2020 at 10:17)</a>:</h4>
<p>that change seems absolutely fine to me <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span> gj</p>



<a name="219453503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219453503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219453503">(Dec 10 2020 at 10:17)</a>:</h4>
<p>did you already run a perf run with the current changes?</p>



<a name="219453955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219453955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219453955">(Dec 10 2020 at 10:21)</a>:</h4>
<p>why do you wrap <code>PredicateKind::Atom</code> with a dummy binder in <a href="https://github.com/jackh726/rust/blob/5698bff0034bcd5535be7e508358a2826f985efd/compiler/rustc_infer/src/traits/util.rs#L18">https://github.com/jackh726/rust/blob/5698bff0034bcd5535be7e508358a2826f985efd/compiler/rustc_infer/src/traits/util.rs#L18</a>?</p>



<a name="219454258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219454258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219454258">(Dec 10 2020 at 10:25)</a>:</h4>
<p>ah in <a href="https://github.com/rust-lang/rust/issues/76814">#76814</a></p>



<a name="219483189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219483189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219483189">(Dec 10 2020 at 15:00)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span>  so that</p>



<a name="219483235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219483235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219483235">(Dec 10 2020 at 15:00)</a>:</h4>
<p>That came from a domino effect</p>



<a name="219484250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219484250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219484250">(Dec 10 2020 at 15:07)</a>:</h4>
<p>I don't remember exactly what it was, but in some error cases we have something like <code>for&lt;'a&gt; fn() -&gt; &amp;'a</code> (it wasn't fn, but the point stands). But basically, the <code>'a</code> wasn't in the <em>inputs</em>, so it wasn't counted when bound vars are created, so there was an empty vars list. But in other cases we actually <em>need</em> that. Well, in other cases, having that around is a problem (because there's still a bunch of <code>potentially_qualified</code> around).</p>



<a name="219484503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219484503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219484503">(Dec 10 2020 at 15:09)</a>:</h4>
<p>This started the dominos: <a href="https://github.com/rust-lang/rust/pull/76814/commits/b00b3a12dc10005b9641ed3148261c254f49202f#diff-2c47d694652e4851afc17740220c986ca445f9a9bc0e188893f2089e12024621R1150">https://github.com/rust-lang/rust/pull/76814/commits/b00b3a12dc10005b9641ed3148261c254f49202f#diff-2c47d694652e4851afc17740220c986ca445f9a9bc0e188893f2089e12024621R1150</a></p>



<a name="219484653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219484653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219484653">(Dec 10 2020 at 15:10)</a>:</h4>
<p>The proper solution is to just remove <code>PredicateKind::Atom</code> eventually, I think. (And whenever we currently use that difference, we just check for escaping vars there)</p>



<a name="219484718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219484718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219484718">(Dec 10 2020 at 15:10)</a>:</h4>
<p>so we once again want to go back to <code>Predicate::Trait(Binder(...))</code>?</p>



<a name="219484982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219484982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219484982">(Dec 10 2020 at 15:12)</a>:</h4>
<p>no, just everything would be like the currently <code>PredicateKind::ForAll(Binder(PredicateAtom::...))</code></p>



<a name="219485367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219485367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219485367">(Dec 10 2020 at 15:14)</a>:</h4>
<p>So, I gotta figure out why the hashing is different on CI than local</p>



<a name="219488058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/219488058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#219488058">(Dec 10 2020 at 15:31)</a>:</h4>
<p>Also, re. perf, doesn't look too bad! There might be some improvements to make. But I guess the question is: how much are we will to accept a perf drop? (I.e. at what point can we call the PR "good" module other review comments; I'm somewhat wary of trying to chase optimizations on an already heavy PR that will probably always be perf-negative unless we start <em>using</em> the binders)</p>



<a name="223442655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223442655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223442655">(Jan 20 2021 at 22:01)</a>:</h4>
<p>Love trying to come up with test cases to try to break things:</p>



<a name="223442673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223442673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223442673">(Jan 20 2021 at 22:01)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait I&lt;&#39;a, &#39;b&gt; {
    type As;
}
trait H&lt;&#39;h&gt;: for&lt;&#39;a&gt; I&lt;&#39;a, &#39;h&gt; {}
fn foo2&lt;T&gt;() where T: for&lt;&#39;c&gt; H&lt;&#39;c, As: for&lt;&#39;d&gt; I&lt;&#39;d, &#39;c&gt;&gt; {}
</code></pre></div>



<a name="223443496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223443496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223443496">(Jan 20 2021 at 22:05)</a>:</h4>
<p>As if hrtb supertraits and associated type bounds weren't complicated enough, their interaction is even better</p>



<a name="223445727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223445727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223445727">(Jan 20 2021 at 22:23)</a>:</h4>
<p>The good news is that passes. The bad news is I expected to fail so I might not be writing the right test.</p>



<a name="223473919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223473919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223473919">(Jan 21 2021 at 06:26)</a>:</h4>
<p><span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span>I haven't been properly validating the bound vars for regions (by checking that the kinds are equal), which was masking some still-incorrect shifting</p>



<a name="223473936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223473936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223473936">(Jan 21 2021 at 06:26)</a>:</h4>
<p>Something <em>seemed</em> wrong lol</p>



<a name="223580693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223580693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223580693">(Jan 21 2021 at 22:33)</a>:</h4>
<p>Okay, so, I'm going to babble here for a bit.</p>



<a name="223580764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223580764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223580764">(Jan 21 2021 at 22:34)</a>:</h4>
<p>Maybe it'll help me get my thoughts straight</p>



<a name="223580812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223580812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223580812">(Jan 21 2021 at 22:34)</a>:</h4>
<p>So, let's start by introducing some background</p>



<a name="223580899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223580899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223580899">(Jan 21 2021 at 22:35)</a>:</h4>
<p>imagine you have <code>trait Foo&lt;T&gt; where T: for&lt;'a&gt; Bar&lt;'a&gt; {}</code></p>



<a name="223580982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223580982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223580982">(Jan 21 2021 at 22:36)</a>:</h4>
<p>Where <code>Bar</code> is defined as:</p>
<div class="codehilite"><pre><span></span><code>trait Bar&lt;&#39;a&gt; {
  type As;
}
</code></pre></div>



<a name="223581080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581080">(Jan 21 2021 at 22:37)</a>:</h4>
<p>Then imagine you have a trait ref <code>for&lt;'b&gt; U: Foo&lt;V,  As = &amp;'b ()&gt;</code></p>



<a name="223581117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581117">(Jan 21 2021 at 22:37)</a>:</h4>
<p>(I did explain this bit a while ago above in this topic, but recapping now)</p>



<a name="223581242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581242">(Jan 21 2021 at 22:39)</a>:</h4>
<p>That <code>As = &amp;'b ()</code> bit gets desugared into: <code>for&lt;'a, 'b&gt; &lt;U as Foo&lt;V&gt;&gt;::As = &amp;'b ()</code></p>



<a name="223581262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581262">(Jan 21 2021 at 22:39)</a>:</h4>
<p>Now, let's pause here:</p>



<a name="223581399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581399">(Jan 21 2021 at 22:40)</a>:</h4>
<p>I <em>thought</em> I was handling this correctly. But I wasn't, not quite. I <em>was</em> handling lifetimes in the projection type (<code>&lt;U as Foo&lt;V&gt;&gt;::As</code>) correctly. But I was missing the <code>&amp;'b ()</code> bit.</p>



<a name="223581558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581558">(Jan 21 2021 at 22:42)</a>:</h4>
<p>Perhaps it's also important to define "handling" here: because when you write the trait ref, <code>'b</code> refers to the bound var at index 0 in <code>for&lt;'b&gt;</code>, but in the final projection predicate, it refers to the bound var at index 1 in <code>for&lt;'a, 'b&gt;</code>, we have to shift that somewhere</p>



<a name="223581653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581653">(Jan 21 2021 at 22:43)</a>:</h4>
<p>(also, this was a bad example, since it doesn't show <em>why</em> we need a shift: imagine instead you had <code>trait Foo&lt;'f&gt; ...</code>; then, the projection predicate would be <code>for&lt;'a, 'b&gt; &lt;U as Foo&lt;'a&gt;&gt;::As = &amp;'b ()</code>. So, you really do need both bound vars around)</p>



<a name="223581857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223581857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223581857">(Jan 21 2021 at 22:45)</a>:</h4>
<p>Anyways, like I said, I <em>wasn't</em> shifting the <code>'b</code> in <code>&amp;'b ()</code>. But that's okay, that's actually an easy fix: We can compare <code>for&lt;'a, 'b&gt;</code> with <code>for&lt;'b&gt;</code> and see we added an extra bound var. So we can just take all bound vars in <code>&amp;'b ()</code> and shift by one since it can't contain any bound vars defined elsewhere</p>



<a name="223582019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582019">(Jan 21 2021 at 22:47)</a>:</h4>
<p>(also...GATs...aren't defined well here. But I need to look how this fits with <a href="https://github.com/rust-lang/rust/issues/79554">#79554</a>)</p>



<a name="223582058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582058">(Jan 21 2021 at 22:47)</a>:</h4>
<p>Now, everything I've said so far, I've understood and is straightforward</p>



<a name="223582098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582098">(Jan 21 2021 at 22:48)</a>:</h4>
<p>Now, let's talk about associated type bounds</p>



<a name="223582234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582234">(Jan 21 2021 at 22:49)</a>:</h4>
<p>For reference, imagine we have </p>
<div class="codehilite"><pre><span></span><code>trait Foo&lt;&#39;a&gt; {
type As;
}
</code></pre></div>
<p>with the trait ref<br>
<code>for&lt;'a&gt; T: Foo&lt;'a, As: Foo&lt;'a&gt;&gt;</code></p>



<a name="223582307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582307">(Jan 21 2021 at 22:50)</a>:</h4>
<p>Or, even better</p>



<a name="223582347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582347">(Jan 21 2021 at 22:50)</a>:</h4>
<p>For reference, imagine we have </p>
<div class="codehilite"><pre><span></span><code>trait Foo&lt;&#39;a&gt; {
  type As;
}
trait Bar&lt;&#39;a&gt; {}
</code></pre></div>
<p>with the trait ref<br>
<code>for&lt;'a&gt; T: Foo&lt;'a, As: for&lt;'b&gt; Bar&lt;'a, 'b&gt;&gt;</code></p>



<a name="223582625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582625">(Jan 21 2021 at 22:53)</a>:</h4>
<p>Now, this isn't exactly how it's desugared, you can imagine that the trait ref can be written by these bounds:<br>
<code>for&lt;'a&gt; T: Foo&lt;'a&gt; + for&lt;'a, 'b&gt; &lt;T as Foo&lt;'a&gt;&gt;::As: Bar&lt;'a, 'b&gt;</code></p>



<a name="223582742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582742">(Jan 21 2021 at 22:54)</a>:</h4>
<p>And I want to note here that <code>Bar&lt;'a, 'b&gt;</code> has the bound vars of both <code>for&lt;'a&gt;</code> and <code>for&lt;'b&gt;</code> together</p>



<a name="223582753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223582753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223582753">(Jan 21 2021 at 22:54)</a>:</h4>
<p>Sound familiar?</p>



<a name="223583072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583072">(Jan 21 2021 at 22:58)</a>:</h4>
<p>Well, it somewhat is similar to the supertrait hrtb, but a key difference is lies in that bit I said before:</p>
<blockquote>
<p>But that's okay, that's actually an easy fix: We can compare for&lt;'a, 'b&gt; with for&lt;'b&gt; and see we added an extra bound var.</p>
</blockquote>



<a name="223583155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583155">(Jan 21 2021 at 22:59)</a>:</h4>
<p>Well, turns out, that <code>As = &amp;'b ()</code> versus <code>As: Bar&lt;'a, 'b&gt;</code> difference is massive</p>



<a name="223583165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583165">(Jan 21 2021 at 22:59)</a>:</h4>
<p>In terms of implementation</p>



<a name="223583312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583312">(Jan 21 2021 at 23:01)</a>:</h4>
<p>Well, ugh, I'm actually making this more complicated by not clarifying that ATBs can also be affected by supertrait hrtbs</p>



<a name="223583711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583711">(Jan 21 2021 at 23:05)</a>:</h4>
<p>So, you could imagine a scenario where we end up with a bound like <code>for&lt;'a, 'b, 'c&gt; &lt;T as Baz&lt;'a, 'b&gt;&gt;::As: Bar&lt;'b, 'c&gt;</code> where the definitions look something like </p>
<div class="codehilite"><pre><span></span><code>trait Baz&lt;&#39;a, &#39;b&gt; {
  type As;
}
trait Foo&lt;&#39;b&gt;: for&lt;&#39;a&gt; Baz&lt;&#39;a, &#39;b&gt; {}
trait Bar&lt;&#39;a, &#39;b&gt; {}
for&lt;&#39;b&gt; Foo&lt;&#39;b, As: for&lt;&#39;c&gt; Bar&lt;&#39;b, &#39;c&gt;&gt;&#39;
</code></pre></div>



<a name="223583872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583872">(Jan 21 2021 at 23:07)</a>:</h4>
<p>(I almost certainly botched that example, but you get the picture)</p>



<a name="223583975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223583975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223583975">(Jan 21 2021 at 23:08)</a>:</h4>
<p>Now, back to this</p>
<blockquote>
<p>Well, turns out, that As = &amp;'b () versus As: Bar&lt;'a, 'b&gt; difference is massive</p>
</blockquote>



<a name="223584084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584084">(Jan 21 2021 at 23:09)</a>:</h4>
<p>Well, I guess, first I should elaborate how we could up with the final <code>for&lt;'a, 'b&gt;</code> and <code>for&lt;'a, 'b&gt;</code> binders in the "final" desugaring</p>



<a name="223584152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584152">(Jan 21 2021 at 23:10)</a>:</h4>
<p>For the supertrait hrtb, this is all done through <code>subst_supertrait</code></p>



<a name="223584180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584180">(Jan 21 2021 at 23:10)</a>:</h4>
<p>But for associated type bounds, in the current PR state, this is done by keeping track of the "outer" bound vars for a trait ref</p>



<a name="223584260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584260">(Jan 21 2021 at 23:11)</a>:</h4>
<p>So, for <code>for&lt;'a&gt; T: Foo&lt;'a, As: for&lt;'b&gt; Bar&lt;'a, 'b&gt;&gt;</code>, when looking specifically at the trait ref <code>As: for&lt;'b&gt; Bar&lt;'a, 'b&gt;</code>, the outer bound vars are <code>for&lt;'a&gt;</code></p>



<a name="223584313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584313">(Jan 21 2021 at 23:12)</a>:</h4>
<p>And you can imagine that even nested trait refs, the outer bound vars accumulate</p>



<a name="223584333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584333">(Jan 21 2021 at 23:12)</a>:</h4>
<p>And the "final" bound vars end up being <code>for&lt;'a, 'b&gt;</code>, because they are concatenated</p>



<a name="223584408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584408">(Jan 21 2021 at 23:13)</a>:</h4>
<p>And this is all well and dandy: We know that the outer bound vars has a length of 1, so we can shift all bound vars by 1 when we encounter them</p>



<a name="223584500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584500">(Jan 21 2021 at 23:14)</a>:</h4>
<p>But, this requires keeping track of those in <code>astconv/mod</code></p>



<a name="223584539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584539">(Jan 21 2021 at 23:14)</a>:</h4>
<p>So, my plan was: just do this in resolve</p>



<a name="223584598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584598">(Jan 21 2021 at 23:15)</a>:</h4>
<p>And that works all and good (in resolve, we can just keep track of the fact that we are in nested trait refs) UNTIL YOU ADD IN SUPERTRAITS</p>



<a name="223584602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584602">(Jan 21 2021 at 23:15)</a>:</h4>
<p>and that's where I'm at</p>



<a name="223584757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584757">(Jan 21 2021 at 23:17)</a>:</h4>
<p>Specifically, that devilish example I wrote yesterday:</p>
<div class="codehilite"><pre><span></span><code>trait I&lt;&#39;a, &#39;b, &#39;c&gt; {
    type As;
}
trait H&lt;&#39;a, &#39;b&gt;: for&lt;&#39;c&gt; I&lt;&#39;a, &#39;c, &#39;b&gt; + &#39;a {}
fn foo2&lt;T&gt;() where T: for&lt;&#39;c&gt; H&lt;&#39;c, &#39;c, As: for&lt;&#39;d&gt; H&lt;&#39;d, &#39;c&gt; + &#39;c&gt; {}
</code></pre></div>



<a name="223584977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584977">(Jan 21 2021 at 23:19)</a>:</h4>
<p>Let's try to desugar things a bit</p>



<a name="223584991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223584991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223584991">(Jan 21 2021 at 23:19)</a>:</h4>
<p>But first, let me give everything a completely unique name</p>



<a name="223585103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585103">(Jan 21 2021 at 23:20)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait I&lt;&#39;a, &#39;b, &#39;c&gt; {
    type As;
}
trait H&lt;&#39;d, &#39;e&gt;: for&lt;&#39;f&gt; I&lt;&#39;d, &#39;f, &#39;e&gt; + &#39;d {}
fn foo2&lt;T&gt;() where T: for&lt;&#39;g&gt; H&lt;&#39;g, &#39;g, As: for&lt;&#39;h&gt; H&lt;&#39;h, &#39;g&gt; + &#39;g&gt; {}
</code></pre></div>



<a name="223585144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585144">(Jan 21 2021 at 23:21)</a>:</h4>
<p>And then start to desugar that <code>T: for&lt;'g&gt; H&lt;'g, 'g, As: for&lt;'h&gt; H&lt;'h, 'g&gt; +'g&gt;</code> bound</p>



<a name="223585274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585274">(Jan 21 2021 at 23:22)</a>:</h4>
<p><code>for&lt;'g&gt; T: H&lt;'g, 'g&gt; + for&lt;'g, 'h&gt; &lt;T as H&lt;'g, 'g&gt;::As: H&lt;'h, 'g&gt; + 'g</code></p>



<a name="223585285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585285">(Jan 21 2021 at 23:22)</a>:</h4>
<p>That looks right. And awful</p>



<a name="223585295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585295">(Jan 21 2021 at 23:22)</a>:</h4>
<p>But, not quite done yet</p>



<a name="223585309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585309">(Jan 21 2021 at 23:23)</a>:</h4>
<p>have to subst through supertraits</p>



<a name="223585457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585457">(Jan 21 2021 at 23:25)</a>:</h4>
<p><code>for&lt;'g&gt; T: H&lt;'g, 'g&gt; + for&lt;'f, 'g, 'h&gt; &lt;T as I&lt;'g, 'f, 'g&gt;::As: H&lt;'h, 'g&gt; + 'g + 'g</code></p>



<a name="223585574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585574">(Jan 21 2021 at 23:26)</a>:</h4>
<p>So terrible</p>



<a name="223585698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585698">(Jan 21 2021 at 23:27)</a>:</h4>
<p>Now, let's look at one of the choices I made here: <code>for&lt;'f, 'g, 'h&gt;</code></p>



<a name="223585790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585790">(Jan 21 2021 at 23:28)</a>:</h4>
<p>When creating these bound vars, I first concatenated those that are nested <code>for&lt;'g&gt;</code> and <code>for&lt;'h&gt;</code> and then added those from the super trait <code>'f</code> after</p>



<a name="223585998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223585998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223585998">(Jan 21 2021 at 23:31)</a>:</h4>
<p>This is a bit arbitrary: You could also imagine that I create this by substing the supertraits first and then appending the bound vars: <code>for&lt;'g, 'f, 'h&gt;</code></p>



<a name="223586035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586035">(Jan 21 2021 at 23:31)</a>:</h4>
<p>(also, at this point, I'm working through things in my head, so what I say will be sporadic)</p>



<a name="223586215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586215">(Jan 21 2021 at 23:33)</a>:</h4>
<p>This was has the advantage that we can shift all the bounds of <code>As</code> (in this case <code>: H&lt;'h, 'g&gt;</code>) together</p>



<a name="223586348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586348">(Jan 21 2021 at 23:35)</a>:</h4>
<p>What's difficult here is how the astconv/mod code is written currently</p>



<a name="223586462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586462">(Jan 21 2021 at 23:36)</a>:</h4>
<p>Let's go back to <code>T: for&lt;'g&gt; H&lt;'g, 'g, As: for&lt;'h&gt; H&lt;'h, 'g&gt; +'g&gt;</code></p>



<a name="223586705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586705">(Jan 21 2021 at 23:40)</a>:</h4>
<p>What actually happens is we get a trait ref <code>T: for&lt;'g&gt; H&lt;'g, 'g&gt;</code> and the bounds <code>As: for&lt;'h&gt; H&lt;'h, 'g&gt; + 'g</code></p>



<a name="223586827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586827">(Jan 21 2021 at 23:42)</a>:</h4>
<p>We see that <code>As</code> isn't defined on <code>H</code>, so we subst supertrait until we get <code>T: for&lt;'f, 'g&gt; I&lt;'g, 'f, 'g&gt;</code></p>



<a name="223586869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586869">(Jan 21 2021 at 23:42)</a>:</h4>
<p>Then we can make a projection: <code>for&lt;'f, 'g&gt; &lt;T as I&lt;'g, 'f, 'g&gt;&gt;::As</code></p>



<a name="223586891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586891">(Jan 21 2021 at 23:43)</a>:</h4>
<p>So far, this is okay, since <code>subst_supertrait</code> handles the shifting of vars here</p>



<a name="223586906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223586906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223586906">(Jan 21 2021 at 23:43)</a>:</h4>
<p>But, the vars in <code>As: for&lt;'h&gt; H&lt;'h, 'g&gt; + 'g</code> haven't been shifted</p>



<a name="223587012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223587012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223587012">(Jan 21 2021 at 23:45)</a>:</h4>
<p>And, these are still in <code>hir</code> too, so we can't shift things yet <em>anyways</em></p>



<a name="223587031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223587031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223587031">(Jan 21 2021 at 23:45)</a>:</h4>
<p>(this happens in <code>add_predicates_for_ast_type_binding</code>)</p>



<a name="223587191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223587191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223587191">(Jan 21 2021 at 23:47)</a>:</h4>
<p>It seems like the most straightfoward option here is to pass down the "shift vars by 1" information</p>



<a name="223587417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223587417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223587417">(Jan 21 2021 at 23:50)</a>:</h4>
<p>But I'm really not sure that's quite correct. Some thoughts:<br>
1) What if we have outer bound vars above the current trait ref. Does this get shifted with <code>subst_supertrait</code>? I'm thinking something like <code>for&lt;'a&gt; T: Foo&lt;'a, As: for&lt;'b&gt; H&lt;'a, 'b, As: for&lt;'c&gt; H&lt;'a, 'c&gt;&gt;&gt;</code>. Does that work correctly?<br>
2) That is really terrible having to pass that everywhere.</p>



<a name="223587602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223587602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223587602">(Jan 21 2021 at 23:53)</a>:</h4>
<p>gotta run for now. But yeah, lot's to consider</p>



<a name="223683452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223683452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223683452">(Jan 22 2021 at 18:57)</a>:</h4>
<p>So, I've nearly been able to get this working. By passing through by the "in scope" nested bound vars, as well as the the "shift" that you would get from super trait hrtbs</p>



<a name="223683544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223683544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223683544">(Jan 22 2021 at 18:58)</a>:</h4>
<p>The only kicker right now is the outlives bounds. This isn't <em>quite</em> right yet, but not sure why.</p>



<a name="223683685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223683685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223683685">(Jan 22 2021 at 18:59)</a>:</h4>
<p>Back to <code>T: for&lt;'g&gt; H&lt;'g, 'g, As: for&lt;'h&gt; H&lt;'h, 'g&gt; +'g&gt;</code> again</p>



<a name="223684360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684360">(Jan 22 2021 at 19:04)</a>:</h4>
<p>In <code>H&lt;'h, 'g&gt;</code>, <code>'h</code> should be shifted by 2 (from the "outer" vars, since the bound vars end up as <code>['f, 'g, 'h]</code>), while <code>'g</code> should only be shifted by 1 (the "shift")</p>



<a name="223684398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684398">(Jan 22 2021 at 19:05)</a>:</h4>
<p>The outlives <code>'g</code> also gets shifted by 1</p>



<a name="223684528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684528">(Jan 22 2021 at 19:06)</a>:</h4>
<p>Now let's examine this monstrosity: <code>T: for&lt;'i&gt; H&lt;'i, 'i, As: for&lt;'j&gt; H&lt;'j, 'i, As: for&lt;'k&gt; I&lt;'i, 'k, 'j&gt; + 'j&gt; + 'i&gt;</code></p>



<a name="223684703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684703">(Jan 22 2021 at 19:07)</a>:</h4>
<p>This is difficult</p>



<a name="223684871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684871">(Jan 22 2021 at 19:09)</a>:</h4>
<p>Now, it's probably easiest to break this up into parts</p>



<a name="223684917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223684917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223684917">(Jan 22 2021 at 19:09)</a>:</h4>
<p>You might expect the first round of "simplification" to end up with something that looks like: <code>T: for&lt;'i&gt; H&lt;'i, 'i&gt; + for&lt;'f, 'i, 'j&gt; &lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As: H&lt;'j, 'i, As: for&lt;'k&gt; I&lt;'i, 'k, 'j&gt; + 'j&gt; + 'i</code></p>



<a name="223685010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223685010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223685010">(Jan 22 2021 at 19:10)</a>:</h4>
<p>But is that correct?</p>



<a name="223685115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223685115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223685115">(Jan 22 2021 at 19:11)</a>:</h4>
<p>The only bit that's particularly difficult is that <code>'i</code> at the end</p>



<a name="223685196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223685196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223685196">(Jan 22 2021 at 19:12)</a>:</h4>
<p>But, that <em>is</em> correct</p>



<a name="223685643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223685643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223685643">(Jan 22 2021 at 19:16)</a>:</h4>
<p>The tricky bit is the next level of nesting</p>



<a name="223694949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223694949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223694949">(Jan 22 2021 at 20:26)</a>:</h4>
<p>Fully desugared, that ends up being something like:<br>
<code>T: for&lt;'i&gt; H&lt;'i, 'i&gt;, for&lt;'f, 'i, 'j&gt; &lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As: H&lt;'j, 'i&gt; + 'i, for&lt;'f, 'f, 'i, 'j&gt; &lt;&lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As as I&lt;'i, 'j, 'k&gt;&gt;::As: 'j, for&lt;'f, 'f, 'i, 'j, 'k&gt; &lt;&lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As as I&lt;'i, 'j, 'k&gt;&gt;::As: I&lt;'i, 'k, 'j&gt;</code></p>



<a name="223712604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223712604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223712604">(Jan 22 2021 at 22:54)</a>:</h4>
<p>Okay yeah, the approach I've been taking won't work at all</p>



<a name="223712732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223712732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223712732">(Jan 22 2021 at 22:56)</a>:</h4>
<p>It's also just really ugly</p>



<a name="223712811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223712811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223712811">(Jan 22 2021 at 22:57)</a>:</h4>
<p>I need to just come up with a way to be more lazy with bounds creation, so that I can shift the created bounds <em>before</em> they get added to the <code>Bounds</code></p>



<a name="223712913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223712913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223712913">(Jan 22 2021 at 22:58)</a>:</h4>
<p>I'm not sure there's a way to do that without splitting into multiple allocations though :/</p>



<a name="223712977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223712977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223712977">(Jan 22 2021 at 22:59)</a>:</h4>
<p>But that might be okay if I change the <code>Vec</code>s in <code>Bounds</code> to <code>SmallVec</code>s</p>



<a name="223773556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/223773556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#223773556">(Jan 23 2021 at 20:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/223694949">said</a>:</p>
<blockquote>
<p>Fully desugared, that ends up being something like:<br>
<code>T: for&lt;'i&gt; H&lt;'i, 'i&gt;, for&lt;'f, 'i, 'j&gt; &lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As: H&lt;'j, 'i&gt; + 'i, for&lt;'f, 'f, 'i, 'j&gt; &lt;&lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As as I&lt;'i, 'j, 'k&gt;&gt;::As: 'j, for&lt;'f, 'f, 'i, 'j, 'k&gt; &lt;&lt;T as I&lt;'i, 'f, 'j&gt;&gt;::As as I&lt;'i, 'j, 'k&gt;&gt;::As: I&lt;'i, 'k, 'j&gt;</code></p>
</blockquote>
<p>Of course, I got this wrong. I think it's actually something like:</p>
<div class="codehilite"><pre><span></span><code>T:
    for&lt;&#39;i&gt; H&lt;&#39;i, &#39;i&gt;,
    for&lt;&#39;f, &#39;i&gt; &lt;T as I&lt;&#39;i, &#39;f, &#39;i&gt;&gt;::As: &#39;i,
    for&lt;&#39;f, &#39;i, &#39;j&gt; &lt;T as I&lt;&#39;i, &#39;f, &#39;i&gt;&gt;::As: H&lt;&#39;j, &#39;i&gt;,
    for&lt;&#39;f, &#39;f, &#39;i, &#39;j&gt; &lt;&lt;T as I&lt;&#39;i, &#39;f, &#39;i&gt;&gt;::As as I&lt;&#39;j, &#39;f, &#39;i&gt;&gt;::As: &#39;j,
    for&lt;&#39;f, &#39;f, &#39;i, &#39;j, &#39;k&gt; &lt;&lt;T as I&lt;&#39;i, &#39;f, &#39;i&gt;&gt;::As as I&lt;&#39;j, &#39;f, &#39;i&gt;&gt;::As: I&lt;&#39;i, &#39;k, &#39;j&gt;
</code></pre></div>



<a name="224282485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282485">(Jan 28 2021 at 04:12)</a>:</h4>
<p>So, been thinking about this more</p>



<a name="224282491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282491">(Jan 28 2021 at 04:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/meeting.202021-01-26/near/224110141">said</a>:</p>
<blockquote>
<p>I guess my <em>intuition</em> here is that the problem is that we're making resolve lifetimes do work it shouldn't do</p>
</blockquote>
<p>specifically in regards to this</p>



<a name="224282570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282570">(Jan 28 2021 at 04:14)</a>:</h4>
<p>So, in the PR, I originally figured it's the <em>right</em> idea to track indices of late bound vars in <code>rustc_resolve::late::lifetimes</code>, since that's where things like binder depth and such get collected</p>



<a name="224282606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282606">(Jan 28 2021 at 04:15)</a>:</h4>
<p>And this is probably mostly correct; <em>this</em> is where we know about all the <code>for&lt;...&gt;</code> in scope syntactically and such</p>



<a name="224282677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282677">(Jan 28 2021 at 04:17)</a>:</h4>
<p><em>But</em>, as we can see here, this isn't really completely good</p>



<a name="224282743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282743">(Jan 28 2021 at 04:18)</a>:</h4>
<p>So, first, maybe I should take a quick review to look where we actually are looking at the late bound vars being collected in lifetimes</p>



<a name="224282758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282758">(Jan 28 2021 at 04:18)</a>:</h4>
<p>Specifically, what I'm thinking/considering:</p>



<a name="224282774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282774">(Jan 28 2021 at 04:19)</a>:</h4>
<p>1) When do we <em>actually</em> care about the binder depth, and when are these just collapsed into a single binder level (as are done for poly trait refs)</p>



<a name="224282848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282848">(Jan 28 2021 at 04:21)</a>:</h4>
<p>2) Could we instead just track a set of lifetimes and build the whole bound vars and poly trait ref in when converting the HIR? This essentially requires that we don't independently use/need just the bound vars from the whole poly trait ref.</p>



<a name="224282906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224282906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224282906">(Jan 28 2021 at 04:22)</a>:</h4>
<p>It's perhaps a little difficult right now, because I'm conflating the late bound vars of a <em>function</em> with those in a trait ref</p>



<a name="224283053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283053">(Jan 28 2021 at 04:25)</a>:</h4>
<p>So, looks like we're querying <code>late_bound_vars</code> in 5 places</p>



<a name="224283116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283116">(Jan 28 2021 at 04:26)</a>:</h4>
<p>One is asking the late bound vars of a closure. Which...currently can't exist, but you could imagine they could in the future. I put this under the "like a fn" category</p>



<a name="224283123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283123">(Jan 28 2021 at 04:27)</a>:</h4>
<p>Another is in <code>ty_of_fn</code>, obviously under function category</p>



<a name="224283139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283139">(Jan 28 2021 at 04:27)</a>:</h4>
<p>Then there are in <code>instantiate_lang_item_trait_ref</code>, <code>instantiate_poly_trait_ref_inner</code>, which are obviously in the trait ref category</p>



<a name="224283191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283191">(Jan 28 2021 at 04:28)</a>:</h4>
<p>And then finally in <code>gather_explicit_predicates_of</code>, where we need it for the lifetimes on a bound like <code>for&lt;'a&gt; T&lt;'a&gt;: Trait</code></p>



<a name="224283233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283233">(Jan 28 2021 at 04:29)</a>:</h4>
<p>But that falls under the trait ref category</p>



<a name="224283255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283255">(Jan 28 2021 at 04:29)</a>:</h4>
<p>Next, let's look at all the places we convert an ast region to a region</p>



<a name="224283338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283338">(Jan 28 2021 at 04:31)</a>:</h4>
<p>And how many of those could actually contain late bound vars</p>



<a name="224283474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283474">(Jan 28 2021 at 04:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224283191">said</a>:</p>
<blockquote>
<p>And then finally in <code>gather_explicit_predicates_of</code>, where we need it for the lifetimes on a bound like <code>for&lt;'a&gt; T&lt;'a&gt;: Trait</code></p>
</blockquote>
<p>uh, actually, need to amend this: this is just for the whole bound</p>



<a name="224283501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283501">(Jan 28 2021 at 04:35)</a>:</h4>
<p>But...I guess these are regions occurring in where clauses, so these are early-bound, not late</p>



<a name="224283509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283509">(Jan 28 2021 at 04:35)</a>:</h4>
<p>Err, scratch that, that's not right at all</p>



<a name="224283517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283517">(Jan 28 2021 at 04:35)</a>:</h4>
<p>I was thinking about the fn generics</p>



<a name="224283698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283698">(Jan 28 2021 at 04:39)</a>:</h4>
<p>Well, it sure makes my life easier seeing things wrapped in a <code>Binder::dummy</code>. But more difficult when that's obscured by a <code>to_predicate</code></p>



<a name="224283861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283861">(Jan 28 2021 at 04:43)</a>:</h4>
<p>Okay, on first glance, it definitely looks like the interesting bit is all in astconv/mod</p>



<a name="224283946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283946">(Jan 28 2021 at 04:44)</a>:</h4>
<p>Okay, next question: I'm very obviously messing up the conversion with respect to binder depth, but everything is fine and dandy (for the most part, but that's because of the index, not depth) - so, why is this</p>



<a name="224283999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224283999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224283999">(Jan 28 2021 at 04:45)</a>:</h4>
<p>It's like...the predicates where get...the fact that the binder depth isn't INNERMOST isn't a problem</p>



<a name="224284075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284075">(Jan 28 2021 at 04:47)</a>:</h4>
<p>It's a bit weird</p>



<a name="224284154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284154">(Jan 28 2021 at 04:48)</a>:</h4>
<p>Just for fun, let's just quickly make <em>every</em> late bound region use <code>ty::INNERMOST</code> and if that breaks anything</p>



<a name="224284307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284307">(Jan 28 2021 at 04:52)</a>:</h4>
<p>Actually, a thought just occurred to me that is scary: it's possible that these predicates aren't checked because the functions are instantiated</p>



<a name="224284336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284336">(Jan 28 2021 at 04:53)</a>:</h4>
<p>Any that...means...that I would actually have to write an impl that satisfies <code>T: for&lt;'l, 'i&gt; H&lt;'l, 'i, As: for&lt;'l, 'i, 'j&gt; H&lt;'j, 'i, As: for&lt;'l, 'i, 'j, 'k&gt; H&lt;'l, 'k, As = X&lt;'j, 'k&gt;&gt; + 'j&gt; + 'i&gt;</code> ugh</p>



<a name="224284349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284349">(Jan 28 2021 at 04:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224284154">said</a>:</p>
<blockquote>
<p>Just for fun, let's just quickly make <em>every</em> late bound region use <code>ty::INNERMOST</code> and if that breaks anything</p>
</blockquote>
<p>Okay it does, that's good</p>



<a name="224284846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284846">(Jan 28 2021 at 05:03)</a>:</h4>
<p>Okay, so next thought. Consider this:<br>
<code>fn changer&lt;'a&gt;(mut things: Box&lt;dyn Iterator&lt;Item=&amp;'a mut u8&gt;&gt;)</code></p>



<a name="224284852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284852">(Jan 28 2021 at 05:03)</a>:</h4>
<p><code>'a</code> is late bound</p>



<a name="224284932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224284932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224284932">(Jan 28 2021 at 05:04)</a>:</h4>
<p>but if we split how we handle late bound vars for functions and trait refs, we would have to think of how to handle this</p>



<a name="224285057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224285057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224285057">(Jan 28 2021 at 05:07)</a>:</h4>
<p>and this is also a relatively simple example where we <em>do</em> need to keep track of depth in a way</p>



<a name="224285618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224285618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224285618">(Jan 28 2021 at 05:20)</a>:</h4>
<p>Interesting, this doesn't compile:</p>
<div class="codehilite"><pre><span></span><code>trait A&lt;&#39;a, &#39;b, &#39;c&gt; {}
fn foo&lt;&#39;a&gt;(_: Box&lt;dyn for&lt;&#39;b&gt; Iterator&lt;Item: for&lt;&#39;c&gt; A&lt;&#39;a, &#39;b, &#39;c&gt;&gt;&gt;) {}
</code></pre></div>



<a name="224285626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224285626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224285626">(Jan 28 2021 at 05:20)</a>:</h4>
<div class="codehilite"><pre><span></span><code>fn foo&lt;&#39;a&gt;(_: Box&lt;dyn for&lt;&#39;b&gt; Iterator&lt;Item: for&lt;&#39;c&gt; A&lt;&#39;a, &#39;b, &#39;c&gt;&gt;&gt;) {}
  |        -                                                   ^^ undeclared lifetime
  |        |
  |        help: consider introducing lifetime `&#39;b` here: `&#39;b,`
</code></pre></div>



<a name="224285791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224285791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224285791">(Jan 28 2021 at 05:24)</a>:</h4>
<p>Seems like the inner bounds <em>aren't</em> under the <code>for&lt;'b&gt;</code> binder</p>



<a name="224286194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224286194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224286194">(Jan 28 2021 at 05:33)</a>:</h4>
<p>This <em>might</em> be a bug. I would expect this to work?</p>



<a name="224289163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224289163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224289163">(Jan 28 2021 at 06:38)</a>:</h4>
<p>So:</p>
<div class="codehilite"><pre><span></span><code>trait A&lt;&#39;a, &#39;b&gt; {
    type As;
}
struct B&lt;&#39;a, &#39;b&gt; {
    _a: std::marker::PhantomData&lt;&amp;&#39;a ()&gt;,
    _b: std::marker::PhantomData&lt;&amp;&#39;b ()&gt;,
}
fn foo&lt;&#39;a&gt;(_: Box&lt;dyn for&lt;&#39;b&gt; A&lt;&#39;a, &#39;b, As = B&lt;&#39;a, &#39;b&gt;&gt;&gt;) {}
fn foo2&lt;&#39;a&gt;(_: Box&lt;dyn for&lt;&#39;b&gt; A&lt;&#39;a, &#39;b, As: A&lt;&#39;a, &#39;b&gt;&gt;&gt;) {}
</code></pre></div>



<a name="224289202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224289202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224289202">(Jan 28 2021 at 06:38)</a>:</h4>
<p><code>foo</code> is fine; <code>foo2</code> is not</p>



<a name="224297726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224297726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224297726">(Jan 28 2021 at 08:44)</a>:</h4>
<p><del>So this is essentially <code>for&lt;'a&gt; X: Y&lt;'a&gt;</code>, does that work?</del></p>



<a name="224298560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224298560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224298560">(Jan 28 2021 at 08:53)</a>:</h4>
<p>Ah, so it's also visible with just <code>'b</code>:</p>
<div class="codehilite"><pre><span></span><code>trait A&lt;&#39;b&gt; {}
fn foo(_: dyn for&lt;&#39;b&gt; Iterator&lt;Item: A&lt;&#39;b&gt;&gt;) {}
</code></pre></div>



<a name="224299533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224299533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224299533">(Jan 28 2021 at 09:02)</a>:</h4>
<p>Isn't that kind of the same as this, where the error makes sense?</p>
<div class="codehilite"><pre><span></span><code>fn foo&lt;T&gt;(_: dyn for&lt;&#39;b&gt; Iterator&lt;Item = T&gt;) where T: A&lt;&#39;b&gt; {}
</code></pre></div>



<a name="224326619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224326619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224326619">(Jan 28 2021 at 13:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224299533">said</a>:</p>
<blockquote>
<p>Isn't that kind of the same as this, where the error makes sense?</p>
<p><div class="codehilite"><pre><span></span><code>fn foo&lt;T&gt;(_: dyn for&lt;&#39;b&gt; Iterator&lt;Item = T&gt;) where T: A&lt;&#39;b&gt; {}
</code></pre></div><br>
</p>
</blockquote>
<p>Nope, this is different. Here <code>'b</code> is in the <code>where</code> clauses, which is outside the <code>dyn</code> whereas in the above two examples, <code>'a</code> is only in the <code>dyn</code>. (Also the <code>dyn</code> for your example needs to be under some kind of reference)</p>



<a name="224327152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224327152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224327152">(Jan 28 2021 at 13:46)</a>:</h4>
<p>The error occurs even without the box (but you're right in that it's an nonsensical example otherwise)</p>



<a name="224328828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224328828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224328828">(Jan 28 2021 at 14:00)</a>:</h4>
<p>I imagine it's because the error occurs during resolve, and so it rustc doesn't get to typeck where the sized constraint would be checked</p>



<a name="224383421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224383421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224383421">(Jan 28 2021 at 19:52)</a>:</h4>
<p>Of course this works: <code>fn foo2&lt;'a&gt;(_: Box&lt;dyn for&lt;'b&gt; A&lt;'a, 'b, As = &amp;dyn A&lt;'a, 'b, As = B&lt;'a, 'b&gt;&gt;&gt;&gt;) {}</code></p>



<a name="224567812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567812">(Jan 30 2021 at 05:46)</a>:</h4>
<p>So, uh, I think the predicates that are generated <em>do</em> in fact generate escaping bound vars (and that's probably incorrect). See <a href="https://github.com/rust-lang/rust/blob/0248c6f178ab3a4d2ec702b7d418ff8375ab0515/compiler/rustc_trait_selection/src/traits/wf.rs#L704">here</a> here predicates are filtered for not having escaping bound vars during wf</p>



<a name="224567824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567824">(Jan 30 2021 at 05:47)</a>:</h4>
<p>This feels wrong to me</p>



<a name="224567833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567833">(Jan 30 2021 at 05:47)</a>:</h4>
<p>But I don't know if this is "expected" and handled elsewhere</p>



<a name="224567885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567885">(Jan 30 2021 at 05:48)</a>:</h4>
<p>If I remove that filter, we can't even compile core</p>



<a name="224567952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567952">(Jan 30 2021 at 05:50)</a>:</h4>
<p>Example:</p>



<a name="224567953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567953">(Jan 30 2021 at 05:50)</a>:</h4>
<p>During WF checking of <code>num::flt2dec::to_shortest_str</code></p>



<a name="224567969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224567969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224567969">(Jan 30 2021 at 05:51)</a>:</h4>
<p>This obligation is generated: <code>Obligation(predicate=Binder(TraitPredicate(&lt;(&amp;num::flt2dec::decoder::Decoded, &amp;'a mut [mem::maybe_uninit::MaybeUninit&lt;u8&gt;]) as marker::Sized&gt;), []), depth=0),</code></p>



<a name="224568017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568017">(Jan 30 2021 at 05:52)</a>:</h4>
<p>And that fails</p>



<a name="224568039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568039">(Jan 30 2021 at 05:53)</a>:</h4>
<p>(I just realized this is potentially a bad example since I might expect there to be binders there in this case...)</p>



<a name="224568141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568141">(Jan 30 2021 at 05:56)</a>:</h4>
<p>Okay, next example: WF checking of <code>&lt;slice::iter::RSplitNMut&lt;'a, T, P&gt; as iter::traits::iterator::Iterator&gt;::size_hint</code></p>



<a name="224568148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568148">(Jan 30 2021 at 05:56)</a>:</h4>
<p>This obligation is created <code>Obligation(predicate=Binder(TraitPredicate(&lt;(&amp;T,) as marker::Sized&gt;), []), depth=0)</code></p>



<a name="224568258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568258">(Jan 30 2021 at 06:00)</a>:</h4>
<p>Okay, I'm actually seeing a pattern here: the panics I've seen so far have a <code>Fn</code> trait where these predicates are originating</p>



<a name="224568676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224568676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224568676">(Jan 30 2021 at 06:14)</a>:</h4>
<p>Okay I mean, the db index <em>is</em> 1, so it's not the poly trait predicate that needs to bound vars (makes sense)</p>



<a name="224730603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730603">(Feb 01 2021 at 14:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you want to chat here or zoom?</p>



<a name="224730638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730638">(Feb 01 2021 at 14:11)</a>:</h4>
<p>I'd rather chat here if that's ok, remote school makes zoom hard in the mornings</p>



<a name="224730691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730691">(Feb 01 2021 at 14:12)</a>:</h4>
<p>That works</p>



<a name="224730693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730693">(Feb 01 2021 at 14:12)</a>:</h4>
<p>Do you want me to read the backscroll though :)</p>



<a name="224730707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730707">(Feb 01 2021 at 14:12)</a>:</h4>
<p>No, I can summarize</p>



<a name="224730755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730755">(Feb 01 2021 at 14:12)</a>:</h4>
<p>Well, so, we talked about bit during the meeting last week</p>



<a name="224730802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730802">(Feb 01 2021 at 14:13)</a>:</h4>
<p>basically, taking this example:</p>



<a name="224730811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730811">(Feb 01 2021 at 14:13)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait I&lt;&#39;a, &#39;b, &#39;c&gt; {
    type As;
}
trait H&lt;&#39;d, &#39;e&gt;: for&lt;&#39;f&gt; I&lt;&#39;d, &#39;f, &#39;e&gt; + &#39;d {}
fn foo2&lt;T&gt;() where T: for&lt;&#39;g&gt; H&lt;&#39;g, &#39;g, As: for&lt;&#39;h&gt; H&lt;&#39;h, &#39;g&gt; + &#39;g&gt; {}
</code></pre></div>



<a name="224730838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730838">(Feb 01 2021 at 14:13)</a>:</h4>
<p>And imagining what predicates should be generated</p>



<a name="224730950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730950">(Feb 01 2021 at 14:14)</a>:</h4>
<p>oh yes, I remember this <del>torture test</del> example :)</p>



<a name="224730988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224730988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224730988">(Feb 01 2021 at 14:14)</a>:</h4>
<p>(I have so much worse ones too <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span>)</p>



<a name="224731046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731046">(Feb 01 2021 at 14:14)</a>:</h4>
<p>ok, this is paging back in</p>



<a name="224731086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731086">(Feb 01 2021 at 14:15)</a>:</h4>
<p>side note, this is making me wonder if we were right to remove nested binders in predicates</p>



<a name="224731087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731087">(Feb 01 2021 at 14:15)</a>:</h4>
<p>Well, up until the end of last week, I imagined that the binders from the outer <code>for&lt;...&gt;</code> would be concatenated onto the bound vars of inner traits</p>



<a name="224731097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731097">(Feb 01 2021 at 14:15)</a>:</h4>
<p>because I think a lot of this stuff becomes easier if we had them</p>



<a name="224731114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731114">(Feb 01 2021 at 14:15)</a>:</h4>
<p>Potentially, yeah</p>



<a name="224731132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731132">(Feb 01 2021 at 14:15)</a>:</h4>
<p>Question is I guess <em>how</em> that would look</p>



<a name="224731318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731318">(Feb 01 2021 at 14:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731087">said</a>:</p>
<blockquote>
<p>Well, up until the end of last week, I imagined that the binders from the outer <code>for&lt;...&gt;</code> would be concatenated onto the bound vars of inner traits</p>
</blockquote>
<p>So, for example, one predicate would be <code>for&lt;'g, 'h, 'f&gt; &lt;T as I&lt;'g, 'f, 'g&gt;&gt;::As: H&lt;'h, 'g&gt;</code></p>



<a name="224731321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731321">(Feb 01 2021 at 14:17)</a>:</h4>
<p>what do you mean by how?</p>



<a name="224731392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731392">(Feb 01 2021 at 14:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731321">said</a>:</p>
<blockquote>
<p>what do you mean by how?</p>
</blockquote>
<p>Well, a current <code>Predicate</code> is essentially <code>Binder&lt;PredicateKind&gt;</code></p>



<a name="224731499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731499">(Feb 01 2021 at 14:18)</a>:</h4>
<p>I guess, I'm not quite sure where you would do the "nesting"</p>



<a name="224731528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731528">(Feb 01 2021 at 14:18)</a>:</h4>
<p>Ah, well, one of the <code>PredicateKind</code> would be a <code>ForAll</code> or whatever</p>



<a name="224731533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731533">(Feb 01 2021 at 14:18)</a>:</h4>
<p>but let's dig in a bit more</p>



<a name="224731543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731543">(Feb 01 2021 at 14:18)</a>:</h4>
<p>I'm not actually recommending that yet</p>



<a name="224731571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731571">(Feb 01 2021 at 14:19)</a>:</h4>
<p>Right yeah, there's a bit more here that I definitely want some input on, so let me continue</p>



<a name="224731635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731635">(Feb 01 2021 at 14:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731318">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731087">said</a>:</p>
<blockquote>
<p>Well, up until the end of last week, I imagined that the binders from the outer <code>for&lt;...&gt;</code> would be concatenated onto the bound vars of inner traits</p>
</blockquote>
<p>So, for example, one predicate would be <code>for&lt;'g, 'h, 'f&gt; &lt;T as I&lt;'g, 'f, 'g&gt;&gt;::As: H&lt;'h, 'g&gt;</code></p>
</blockquote>
<p>Now, we arrive here because of a mix of the nested binders and the supertrait HRTB</p>



<a name="224731739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731739">(Feb 01 2021 at 14:20)</a>:</h4>
<p>And it's important to note all the shifting (indices at binder level 0) that could need to go on here</p>



<a name="224731771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731771">(Feb 01 2021 at 14:20)</a>:</h4>
<p><em>And</em> I thought this was going to be the difficult part</p>



<a name="224731787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731787">(Feb 01 2021 at 14:20)</a>:</h4>
<p>And was indeed running into issues</p>



<a name="224731822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731822">(Feb 01 2021 at 14:21)</a>:</h4>
<p><em>But</em> I thought this was just about finding the right system/place to do this, but felt doable</p>



<a name="224731904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224731904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224731904">(Feb 01 2021 at 14:21)</a>:</h4>
<p>fyi I pulled the example <a href="https://gist.github.com/nikomatsakis/76a20519df1a06f56a9f885829dc75f8">into a gist</a> so I can have it open while I read</p>



<a name="224732021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732021">(Feb 01 2021 at 14:22)</a>:</h4>
<p>(The eventual system that I <em>wanted</em> to implement was to just delay assigning bound var indices until ast conversion, but I wasn't able to finish that implementation before I fell into the rabbit hole)</p>



<a name="224732134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732134">(Feb 01 2021 at 14:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731904">said</a>:</p>
<blockquote>
<p>fyi I pulled the example <a href="https://gist.github.com/nikomatsakis/76a20519df1a06f56a9f885829dc75f8">into a gist</a> so I can have it open while I read</p>
</blockquote>
<p>I've been doing things like <a href="/user_uploads/4715/MKBMwnrdaazA0xP1g5HJjdn9/image.png">image.png</a>  to help me keep track of the predicates that need to be generated</p>
<div class="message_inline_image"><a href="/user_uploads/4715/MKBMwnrdaazA0xP1g5HJjdn9/image.png" title="image.png"><img src="/user_uploads/4715/MKBMwnrdaazA0xP1g5HJjdn9/image.png"></a></div>



<a name="224732160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732160">(Feb 01 2021 at 14:23)</a>:</h4>
<p>It's so bad</p>



<a name="224732203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732203">(Feb 01 2021 at 14:23)</a>:</h4>
<p>oh dear</p>



<a name="224732271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732271">(Feb 01 2021 at 14:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224731822">said</a>:</p>
<blockquote>
<p><em>But</em> I thought this was just about finding the right system/place to do this, but felt doable</p>
</blockquote>
<p>Anyways, while trying to implement the new scheme (after failing a couple times), I found something shocking</p>



<a name="224732301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732301">(Feb 01 2021 at 14:24)</a>:</h4>
<p>ok</p>



<a name="224732307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732307">(Feb 01 2021 at 14:24)</a>:</h4>
<p>Well, at first, I was a bit curious, not so much shocked</p>



<a name="224732344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732344">(Feb 01 2021 at 14:24)</a>:</h4>
<p>But, the predicates that are getting generated <em>do</em> have escaping bound vars</p>



<a name="224732421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732421">(Feb 01 2021 at 14:25)</a>:</h4>
<p>(specially, I was wondering for something like <code>fn foo2&lt;'a&gt;(_: Box&lt;dyn for&lt;'b&gt; A&lt;'a, 'b, As = &amp;dyn A&lt;'a, 'b, As = B&lt;'a, 'b&gt;&gt;&gt;&gt;) {}</code>, what predicates get generated for WF and such)</p>



<a name="224732469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732469">(Feb 01 2021 at 14:25)</a>:</h4>
<p>Honestly, you can hate me for these examples, they are awful and I know it</p>



<a name="224732524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732524">(Feb 01 2021 at 14:26)</a>:</h4>
<p>I'm loving it</p>



<a name="224732573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732573">(Feb 01 2021 at 14:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224732344">said</a>:</p>
<blockquote>
<p>But, the predicates that are getting generated <em>do</em> have escaping bound vars</p>
</blockquote>
<p>So, I was like "huh, these have escaping bound vars, how are these predicates solved"</p>



<a name="224732652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732652">(Feb 01 2021 at 14:27)</a>:</h4>
<p>Well, then I found that we're skipping predicates in places that have escaping bound vars</p>



<a name="224732663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732663">(Feb 01 2021 at 14:27)</a>:</h4>
<p>(link incoming)</p>



<a name="224732672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732672">(Feb 01 2021 at 14:27)</a>:</h4>
<p>yes</p>



<a name="224732685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732685">(Feb 01 2021 at 14:27)</a>:</h4>
<p>I know about this</p>



<a name="224732698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732698">(Feb 01 2021 at 14:27)</a>:</h4>
<p>one of the things i'd like to change at some point via chalk</p>



<a name="224732708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732708">(Feb 01 2021 at 14:27)</a>:</h4>
<p>there's a justification for how it's supposed to work</p>



<a name="224732743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732743">(Feb 01 2021 at 14:28)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/e0d9f793990d20f8f640097e28556886ba5362f0/compiler/rustc_trait_selection/src/traits/wf.rs#L704">here</a></p>



<a name="224732815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732815">(Feb 01 2021 at 14:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224732708">said</a>:</p>
<blockquote>
<p>there's a justification for how it's supposed to work</p>
</blockquote>
<p>Okay good; I would love to hear this</p>



<a name="224732861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732861">(Feb 01 2021 at 14:28)</a>:</h4>
<p>Basically though, removing e.g. that filter completely breaks everything</p>



<a name="224732898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732898">(Feb 01 2021 at 14:28)</a>:</h4>
<p><a href="https://rust-lang.github.io/rfcs/1214-projections-lifetimes-and-wf.html#wf-checking-and-higher-ranked-types">c.f. this RFC</a></p>



<a name="224732939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732939">(Feb 01 2021 at 14:29)</a>:</h4>
<p>I think?</p>



<a name="224732948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732948">(Feb 01 2021 at 14:29)</a>:</h4>
<p>But anyways, I was like "okay cool, we just filter out predicates that have escaping bound vars. I'll just generate clauses without shifting things around"</p>



<a name="224732985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224732985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224732985">(Feb 01 2021 at 14:29)</a>:</h4>
<p>So, I did that this weekend (well, into late last night)</p>



<a name="224733009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733009">(Feb 01 2021 at 14:29)</a>:</h4>
<p>And now a bunch of the associated type bounds tests fail</p>



<a name="224733124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733124">(Feb 01 2021 at 14:30)</a>:</h4>
<p>Because of something like </p>
<div class="codehilite"><pre><span></span><code>cannot relate bound region: ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:12 ~ atb[317d]::where_bound_region_forall2::&#39;a), &#39;a) }) &lt;= RePlaceholder(Placeholder { universe: U1, name: BrNamed(DefId(0:16 ~ atb[317d]::desugared_bound_region_forall2::&#39;a#1), &#39;a) })
</code></pre></div>



<a name="224733179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733179">(Feb 01 2021 at 14:30)</a>:</h4>
<p>Minimal example: </p>
<div class="codehilite"><pre><span></span><code>fn where_bound_region_forall2&lt;B&gt;(beta: B) -&gt; usize
where
    B: Beta&lt;Gamma: for&lt;&#39;a&gt; Epsilon&lt;&#39;a, Zeta: Eta&gt;&gt;,
{
    desugared_bound_region_forall2(beta)
}

pub fn desugared_bound_region_forall2&lt;B&gt;(beta: B) -&gt; usize
where
    B: Beta,
    B::Gamma: for&lt;&#39;a&gt; Epsilon&lt;&#39;a&gt;,
    for&lt;&#39;a&gt; &lt;B::Gamma as Epsilon&lt;&#39;a&gt;&gt;::Zeta: Eta,
{
    0
}
</code></pre></div>



<a name="224733327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733327">(Feb 01 2021 at 14:31)</a>:</h4>
<p>Basically, for <code>where_bound_region_forall2</code>, we're generating a trait ref <code>for&lt;&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'^1.0&gt;&gt;::Zeta: Eta</code></p>



<a name="224733332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733332">(Feb 01 2021 at 14:31)</a>:</h4>
<p>(I will say that I feel like if we have to 'renumber' indices that is a "yellow flag")</p>



<a name="224733427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733427">(Feb 01 2021 at 14:32)</a>:</h4>
<p>But because of the second, we expect <code>for&lt;'a&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'^0.0&gt;&gt;::Zeta: Eta</code></p>



<a name="224733440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733440">(Feb 01 2021 at 14:32)</a>:</h4>
<p>And yeah, things fail</p>



<a name="224733470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733470">(Feb 01 2021 at 14:32)</a>:</h4>
<p>This <em>might</em> just be an implementation problem, I have to look over again</p>



<a name="224733580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733580">(Feb 01 2021 at 14:33)</a>:</h4>
<p>A slice of the changes are here: <a href="https://github.com/rust-lang/rust/compare/12cf554...jackh726:binder-refactor-rebase">https://github.com/rust-lang/rust/compare/12cf554...jackh726:binder-refactor-rebase#</a></p>



<a name="224733672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733672">(Feb 01 2021 at 14:34)</a>:</h4>
<p>Or here to include all the binder refactor changes: <a href="https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-rebase">https://github.com/rust-lang/rust/compare/master...jackh726:binder-refactor-rebase#</a></p>



<a name="224733719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733719">(Feb 01 2021 at 14:34)</a>:</h4>
<p>But basically, that's a lot of background/explanation to essentially ask: What the heck should we do here?</p>



<a name="224733733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733733">(Feb 01 2021 at 14:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224733427">said</a>:</p>
<blockquote>
<p>But because the second, we expect <code>for&lt;'a&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'^0.0&gt;&gt;::Zeta: Eta</code></p>
</blockquote>
<p>"the second"?</p>



<a name="224733798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733798">(Feb 01 2021 at 14:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224733733">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224733427">said</a>:</p>
<blockquote>
<p>But because the second, we expect <code>for&lt;'a&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'^0.0&gt;&gt;::Zeta: Eta</code></p>
</blockquote>
<p>"the second"?</p>
</blockquote>
<p>oops, meant to say for the second function</p>



<a name="224733896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733896">(Feb 01 2021 at 14:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224733327">said</a>:</p>
<blockquote>
<p>Basically, for <code>where_bound_region_forall2</code>, we're generating a trait ref <code>for&lt;&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'^1.0&gt;&gt;::Zeta: Eta</code></p>
</blockquote>
<p>is the <code>^1.0</code> intentionally escaping here?</p>



<a name="224733910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733910">(Feb 01 2021 at 14:35)</a>:</h4>
<p>i.e., it is not referencing the <code>for</code>, right?</p>



<a name="224733968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733968">(Feb 01 2021 at 14:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224733332">said</a>:</p>
<blockquote>
<p>(I will say that I feel like if we have to 'renumber' indices that is a "yellow flag")</p>
</blockquote>
<p>Right, which is why I think/thought the approach of assigning indices <em>late</em> would be good</p>



<a name="224733999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224733999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224733999">(Feb 01 2021 at 14:36)</a>:</h4>
<p>But it really just is completely different from how it's done now</p>



<a name="224734113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734113">(Feb 01 2021 at 14:37)</a>:</h4>
<p>Part of that thought is really thinking about <em>when</em> and <em>where</em> we need to know "we're <em>actually</em> nested in <code>for</code>s" instead of "we're generating a predicate with these lifetimes in scope"</p>



<a name="224734317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734317">(Feb 01 2021 at 14:39)</a>:</h4>
<p>hmm</p>



<a name="224734328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734328">(Feb 01 2021 at 14:39)</a>:</h4>
<p>I'm feeling like this cannot be simply answered</p>



<a name="224734350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734350">(Feb 01 2021 at 14:39)</a>:</h4>
<p>I'm thinking maybe we need to schedule a longer deep dive to pour over the PR</p>



<a name="224734367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734367">(Feb 01 2021 at 14:39)</a>:</h4>
<p>but it might also be useful</p>



<a name="224734386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734386">(Feb 01 2021 at 14:39)</a>:</h4>
<p>to step back from the grungy details of what you're doing <em>now</em> to how we kind of <em>expect</em> it to work</p>



<a name="224734502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734502">(Feb 01 2021 at 14:40)</a>:</h4>
<p>Also fair</p>



<a name="224734552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734552">(Feb 01 2021 at 14:40)</a>:</h4>
<p>I will note: this is all super straightfoward if you don't have to think about associated type bounds :)</p>



<a name="224734590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734590">(Feb 01 2021 at 14:41)</a>:</h4>
<p>do you mean the <code>Foo&lt;A: Bar&gt;</code> things?</p>



<a name="224734607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734607">(Feb 01 2021 at 14:41)</a>:</h4>
<p>yeah</p>



<a name="224734627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734627">(Feb 01 2021 at 14:41)</a>:</h4>
<p>But no, I have to go and generate pesky examples like <code>T: for&lt;'l, 'i&gt; H&lt;'l, 'i, As: for&lt;'l, 'i, 'j&gt; H&lt;'j, 'i, As: for&lt;'l, 'i, 'j, 'k&gt; H&lt;'l, 'k, As = X&lt;'j, 'k&gt;&gt; + 'j&gt; + 'i&gt;</code></p>



<a name="224734667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734667">(Feb 01 2021 at 14:41)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    B: Beta&lt;Gamma: for&lt;&#39;a&gt; Epsilon&lt;&#39;a, Zeta: Eta&gt;&gt;,
</code></pre></div>



<a name="224734735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734735">(Feb 01 2021 at 14:42)</a>:</h4>
<p>so for this...</p>



<a name="224734773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734773">(Feb 01 2021 at 14:42)</a>:</h4>
<p>(I've also <em>added</em> to the test suite around these in the PR since I've thought about this and realized that the current tests in this area are lacking)</p>



<a name="224734818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734818">(Feb 01 2021 at 14:42)</a>:</h4>
<p>ugh, the nested bounds :)</p>



<a name="224734847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734847">(Feb 01 2021 at 14:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224734818">said</a>:</p>
<blockquote>
<p>ugh, the nested bounds :)</p>
</blockquote>
<p>That's been my last 2 or so weeks</p>



<a name="224734931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224734931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224734931">(Feb 01 2021 at 14:43)</a>:</h4>
<ul>
<li><code>for&lt;'a&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'a&gt;&gt;::Zeta: Eta</code></li>
</ul>



<a name="224735122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735122">(Feb 01 2021 at 14:45)</a>:</h4>
<p>that is what I expect, for sure</p>



<a name="224735161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735161">(Feb 01 2021 at 14:45)</a>:</h4>
<p>Okay, that's...probably what I expect too</p>



<a name="224735315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735315">(Feb 01 2021 at 14:46)</a>:</h4>
<p>probably I expect multiple predciates</p>



<a name="224735332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735332">(Feb 01 2021 at 14:46)</a>:</h4>
<p>have to step afk for a bit</p>



<a name="224735496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735496">(Feb 01 2021 at 14:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224735315">said</a>:</p>
<blockquote>
<p>probably I expect multiple predciates</p>
</blockquote>
<p>Yeah, <code>for&lt;&gt; B: Beta</code>, <code>for&lt;'a&gt; &lt;B as Beta::Gamma: Epsilon&lt;'a&gt;</code>, and <code>for&lt;'a&gt; &lt;&lt;B as Beta&gt;::Gamma as Epsilon&lt;'a&gt;&gt;::Zeta: Eta</code></p>



<a name="224735616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735616">(Feb 01 2021 at 14:48)</a>:</h4>
<p>Okay, then, how does interact, e.g. with trait objects?</p>



<a name="224735700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735700">(Feb 01 2021 at 14:49)</a>:</h4>
<p>My example (<code>fn foo2&lt;'a&gt;(_: Box&lt;dyn for&lt;'b&gt; A&lt;'a, 'b, As = &amp;dyn A&lt;'a, 'b, As = B&lt;'a, 'b&gt;&gt;&gt;&gt;) {}</code>) has this as an input type, but you can generate a similar example where that is in a where clause</p>



<a name="224735962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224735962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224735962">(Feb 01 2021 at 14:50)</a>:</h4>
<p>And the question is: would the bound vars in predicate for the inner <code>As = ...</code> have a db index of 0 (so, the bound vars "trickle" down), or 1 (so, we are referencing the <code>dyn</code> binders)</p>



<a name="224736669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224736669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224736669">(Feb 01 2021 at 14:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224735616">said</a>:</p>
<blockquote>
<p>Okay, then, how does interact, e.g. with trait objects?</p>
</blockquote>



<a name="224736714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224736714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224736714">(Feb 01 2021 at 14:56)</a>:</h4>
<p>so...wf and trait objects has been a tricky question for a long time</p>



<a name="224736757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224736757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224736757">(Feb 01 2021 at 14:56)</a>:</h4>
<p>I'm aware of a bit of it haha</p>



<a name="224736784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224736784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224736784">(Feb 01 2021 at 14:56)</a>:</h4>
<p>that said</p>



<a name="224737194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737194">(Feb 01 2021 at 14:59)</a>:</h4>
<p>I can also just imagine a system that <em>all</em> late bound vars get concatenated together for predicates</p>



<a name="224737279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737279">(Feb 01 2021 at 15:00)</a>:</h4>
<p>And that should mean that predicates would no longer have escaping bound vars</p>



<a name="224737358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737358">(Feb 01 2021 at 15:00)</a>:</h4>
<p>so..predicates should not have escaping bound vars</p>



<a name="224737370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737370">(Feb 01 2021 at 15:00)</a>:</h4>
<p>but it depends on what you mean by escaping</p>



<a name="224737445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737445">(Feb 01 2021 at 15:00)</a>:</h4>
<p>Well, when I removed that filter</p>



<a name="224737513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737513">(Feb 01 2021 at 15:01)</a>:</h4>
<p>The only predicates I saw (but there could be others) that had escaping bound vars</p>



<a name="224737554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737554">(Feb 01 2021 at 15:01)</a>:</h4>
<p>Were ones where you have a <code>T: FnOnce(...)</code> bound</p>



<a name="224737555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737555">(Feb 01 2021 at 15:01)</a>:</h4>
<p>ok so</p>



<a name="224737564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737564">(Feb 01 2021 at 15:01)</a>:</h4>
<p>the challenge with trait objects</p>



<a name="224737583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737583">(Feb 01 2021 at 15:01)</a>:</h4>
<p>(or <code>Fn</code>/<code>FnMut</code>)</p>



<a name="224737584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737584">(Feb 01 2021 at 15:01)</a>:</h4>
<p>and WF in general</p>



<a name="224737621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737621">(Feb 01 2021 at 15:01)</a>:</h4>
<p>around higher-ranked things, anyway</p>



<a name="224737750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737750">(Feb 01 2021 at 15:02)</a>:</h4>
<p>is that there are implied relationships between the regions -- e.g., <code>for&lt;'a, 'b&gt; fn(&amp;'a &amp;'b u32)</code>, for that reference type to be valid, <code>'b: 'a</code> must hold</p>



<a name="224737782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737782">(Feb 01 2021 at 15:02)</a>:</h4>
<p>but there is no "where clause" in the Rust notation to indicate that</p>



<a name="224737851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737851">(Feb 01 2021 at 15:03)</a>:</h4>
<p>right</p>



<a name="224737854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737854">(Feb 01 2021 at 15:03)</a>:</h4>
<p>so if you did what seems like the <em>right thing</em>, you would generate a predicate like <code>for&lt;'a, 'b&gt; { 'b: 'a }</code> which would fail</p>



<a name="224737913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737913">(Feb 01 2021 at 15:03)</a>:</h4>
<p>what we do instead is to skip those, but then, when those <code>for</code> clauses are instantiated with concrete regions, we impose the WF checks <em>then</em></p>



<a name="224737932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737932">(Feb 01 2021 at 15:03)</a>:</h4>
<p>I'd prefer to change this but never mind</p>



<a name="224737957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224737957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224737957">(Feb 01 2021 at 15:03)</a>:</h4>
<p>Oh, oof, I see</p>



<a name="224738146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738146">(Feb 01 2021 at 15:04)</a>:</h4>
<p>Why is this so difficult lol</p>



<a name="224738183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738183">(Feb 01 2021 at 15:04)</a>:</h4>
<p>so how does this apply to your example...</p>



<a name="224738203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738203">(Feb 01 2021 at 15:05)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224735700">said</a>:</p>
<blockquote>
<p>My example (<code>fn foo2&lt;'a&gt;(_: Box&lt;dyn for&lt;'b&gt; A&lt;'a, 'b, As = &amp;dyn A&lt;'a, 'b, As = B&lt;'a, 'b&gt;&gt;&gt;&gt;) {}</code>) has this as an input type, but you can generate a similar example where that is in a where clause</p>
</blockquote>



<a name="224738292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738292">(Feb 01 2021 at 15:05)</a>:</h4>
<p>so yeah basically we would not generate much in the way of WF conditions</p>



<a name="224738319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738319">(Feb 01 2021 at 15:05)</a>:</h4>
<p><em>untily</em> you invoked a method on the <code>dyn</code></p>



<a name="224738323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738323">(Feb 01 2021 at 15:05)</a>:</h4>
<p>or accessed a member</p>



<a name="224738384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738384">(Feb 01 2021 at 15:06)</a>:</h4>
<p>which would cause us to instantiate <code>'b</code> with a concrete region</p>



<a name="224738440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738440">(Feb 01 2021 at 15:06)</a>:</h4>
<p>which would mean you have a non-polymorphic <code>A&lt;'A, 'B, As = &amp;dyn A&lt;'A, 'B...&gt;&gt;</code></p>



<a name="224738471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738471">(Feb 01 2021 at 15:06)</a>:</h4>
<p>that's what the WF code is trying to do, anyway</p>



<a name="224738526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738526">(Feb 01 2021 at 15:07)</a>:</h4>
<p>I have to go now but maybe it's a good idea for us to schedule some more time to dig into this -- I guess we could do it on Tuesday</p>



<a name="224738542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738542">(Feb 01 2021 at 15:07)</a>:</h4>
<p>I'd sort of like to sketch what nested binders might look like</p>



<a name="224738565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738565">(Feb 01 2021 at 15:07)</a>:</h4>
<p>one thought I had is that maybe we want to have two copies of <code>Predicate</code></p>



<a name="224738576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738576">(Feb 01 2021 at 15:07)</a>:</h4>
<p>i.e., we might have one version that has nested binders</p>



<a name="224738584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738584">(Feb 01 2021 at 15:07)</a>:</h4>
<p>which we then "compress"</p>



<a name="224738632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738632">(Feb 01 2021 at 15:07)</a>:</h4>
<p>it seems like most phases of the compiler found it convenient to not have to think about nested binders</p>



<a name="224738677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738677">(Feb 01 2021 at 15:08)</a>:</h4>
<p>but I think that in the AST -&gt; TY phase, that is not true</p>



<a name="224738702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738702">(Feb 01 2021 at 15:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224738526">said</a>:</p>
<blockquote>
<p>I have to go now but maybe it's a good idea for us to schedule some more time to dig into this -- I guess we could do it on Tuesday</p>
</blockquote>
<p>Tuesday works</p>



<a name="224738744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738744">(Feb 01 2021 at 15:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224738632">said</a>:</p>
<blockquote>
<p>it seems like most phases of the compiler found it convenient to not have to think about nested binders</p>
</blockquote>
<p>I think you're correct here</p>



<a name="224738746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738746">(Feb 01 2021 at 15:08)</a>:</h4>
<p>I think a lot of this "depth/index math" would  get much simpler if we could isolate it</p>



<a name="224738807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738807">(Feb 01 2021 at 15:08)</a>:</h4>
<p>in short, this feels like a classic case of trying to do "too much lowering" in one step</p>



<a name="224738827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738827">(Feb 01 2021 at 15:09)</a>:</h4>
<p>I think that we can get away with not worrying about "nesting" at all</p>



<a name="224738853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738853">(Feb 01 2021 at 15:09)</a>:</h4>
<p>Just thinking about vars in scope</p>



<a name="224738881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738881">(Feb 01 2021 at 15:09)</a>:</h4>
<p>But...I'm not sure how that fits into what you wrote above</p>



<a name="224738913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738913">(Feb 01 2021 at 15:09)</a>:</h4>
<p>I might be wrong</p>



<a name="224738936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738936">(Feb 01 2021 at 15:10)</a>:</h4>
<p>I guess I should make a point to read your PR and be familiar with it before Tuesday</p>



<a name="224738939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224738939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224738939">(Feb 01 2021 at 15:10)</a>:</h4>
<p>which I can do :)</p>



<a name="224739019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739019">(Feb 01 2021 at 15:10)</a>:</h4>
<p>Well...most of the PR is actually pretty straightforward</p>



<a name="224739057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739057">(Feb 01 2021 at 15:10)</a>:</h4>
<p>It's this one edge case bit that's thrown everything out of whack</p>



<a name="224739280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739280">(Feb 01 2021 at 15:12)</a>:</h4>
<p>ok</p>



<a name="224739297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739297">(Feb 01 2021 at 15:12)</a>:</h4>
<p>I have to go do some other prep</p>



<a name="224739335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739335">(Feb 01 2021 at 15:12)</a>:</h4>
<p>But, I'll see if I can implement my scheme and see how it goes (famous last words)</p>



<a name="224739352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739352">(Feb 01 2021 at 15:12)</a>:</h4>
<p>Okay, talk tomorrow!</p>



<a name="224739356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739356">(Feb 01 2021 at 15:12)</a>:</h4>
<p>seems good</p>



<a name="224739364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739364">(Feb 01 2021 at 15:12)</a>:</h4>
<p>hopefully this helped a <em>little</em></p>



<a name="224739417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/224739417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#224739417">(Feb 01 2021 at 15:13)</a>:</h4>
<p>If nothing else, it helps me get things more straight in my mind</p>



<a name="225214517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214517">(Feb 04 2021 at 20:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> are interested in helping out with this?</p>



<a name="225214539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214539">(Feb 04 2021 at 20:02)</a>:</h4>
<p>It's honestly making my head hurt lol</p>



<a name="225214580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214580">(Feb 04 2021 at 20:03)</a>:</h4>
<p>I'm interested in helping in whatever is around in this wg :)</p>



<a name="225214632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214632">(Feb 04 2021 at 20:03)</a>:</h4>
<p>mainly if someone more knowledgeable is around just in case :)</p>



<a name="225214667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214667">(Feb 04 2021 at 20:03)</a>:</h4>
<p>So, if you want to scroll through and read this thread starting from <a href="#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224730707">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/rustc.20binder.20refactor/near/224730707</a></p>



<a name="225214725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214725">(Feb 04 2021 at 20:04)</a>:</h4>
<p>That'll give you much of the background on the current problem to be solved</p>



<a name="225214751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214751">(Feb 04 2021 at 20:04)</a>:</h4>
<p>gonna try to finish <a href="https://github.com/rust-lang/rust/issues/80732">#80732</a> first and then yeah <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="225214839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225214839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225214839">(Feb 04 2021 at 20:05)</a>:</h4>
<p>Yeah, no problem :)</p>



<a name="225215004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/225215004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#225215004">(Feb 04 2021 at 20:06)</a>:</h4>
<p>Honestly, I'm gonna take a couple days and not work on this (at least myself; I'm more than happy to discuss/mentor). After that, even if I did figure this out, there's plenty of related work for followup</p>



<a name="227540106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/227540106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#227540106">(Feb 24 2021 at 02:52)</a>:</h4>
<p>Well, I don't know what example I used that failed, but I can't find a failing example when mixing hrtbs and atbs</p>



<a name="227540145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/227540145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#227540145">(Feb 24 2021 at 02:52)</a>:</h4>
<p>So that's great <em>and</em> terrible</p>



<a name="227540503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/227540503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#227540503">(Feb 24 2021 at 02:58)</a>:</h4>
<p>ah right, because I'm not confirming kinds</p>



<a name="227541314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc%20binder%20refactor/near/227541314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc.20binder.20refactor.html#227541314">(Feb 24 2021 at 03:10)</a>:</h4>
<p>okay great, got it to repro</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>